<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>CSS Pseudo-Elements Module Level 4</title>
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="exploring" name="csswg-work-status">
  <meta content="ED" name="w3c-status">
  <meta content="This CSS module defines pseudo-elements, abstract elements that represent portions of the CSS render tree that can be selected and styled." name="abstract">
  <link href="../default.css" rel="stylesheet" type="text/css">
  <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
  body {
    background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat;
  }
  </style>
  <link href="https://www.w3.org/TR/css-pseudo-4/" rel="canonical">
<script defer src="https://test.csswg.org/harness/annotate.js#!css-pseudo-4_dev/css-pseudo-4" type="text/javascript"></script>
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: gray;
    color: white;
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: black;
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }</style>
<style>/* style-counters */

body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}</style>
<style>/* style-var-click-highlighting */

    var { cursor: pointer; }
    var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; }
    var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; }
    var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; }
    var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; }
    var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; }
    var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; }
    var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; }
    </style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
    color: #005a9c;
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}</style>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
   <h1 class="p-name no-ref" id="title">CSS Pseudo-Elements Module Level 4</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   <details>
    <summary>Specification Metadata</summary>
    <div data-fill-with="spec-metadata">
     <dl>
      <dt>This version:
      <dd><a class="u-url" href="https://drafts.csswg.org/css-pseudo-4/">https://drafts.csswg.org/css-pseudo-4/</a>
      <dt>Latest published version:
      <dd><a href="https://www.w3.org/TR/css-pseudo-4/">https://www.w3.org/TR/css-pseudo-4/</a>
      <dt>Previous Versions:
      <dd><a href="https://www.w3.org/TR/2016/WD-css-pseudo-4-20160607/" rel="prev">https://www.w3.org/TR/2016/WD-css-pseudo-4-20160607/</a>
      <dd><a href="https://www.w3.org/TR/2015/WD-css-pseudo-4-20150115/" rel="prev">https://www.w3.org/TR/2015/WD-css-pseudo-4-20150115/</a>
      <dt>Test Suite:
      <dd><a href="http://test.csswg.org/suites/css-pseudo-4_dev/nightly-unstable/">http://test.csswg.org/suites/css-pseudo-4_dev/nightly-unstable/</a>
      <dt class="editor">Editors:
      <dd class="editor p-author h-card vcard" data-editor-id="13329"><span class="p-name fn">Daniel Glazman</span> (<span class="p-org org">Disruptive Innovations</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="35400"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika J. Etemad / fantasai</a> (<span class="p-org org">Invited Expert</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="46659"><a class="p-name fn u-email email" href="mailto:stearns@adobe.com">Alan Stearns</a> (<span class="p-org org">Adobe Systems Inc.</span>)
      <dt>Suggest an Edit for this Spec:
      <dd><a href="https://github.com/w3c/csswg-drafts/blob/master/css-pseudo-4/Overview.bs">GitHub Editor</a>
      <dt>Issue Tracking:
      <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-pseudo-4">GitHub Issues</a>
      <dt>Issues List:
      <dd><a href="https://drafts.csswg.org/css-pseudo/#issues-index">Tracked in Editor’s Draft</a>
     </dl>
    </div>
   </details>
   <div data-fill-with="warning"></div>
   <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1970 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a> rules apply. </p>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>This CSS module defines pseudo-elements, abstract elements that represent portions of the CSS render tree that can be selected and styled.</p>
    <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, etc. 
  </div>
  <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
  <div data-fill-with="status">
   <p> This is a public copy of the editors’ draft.
	It is provided for discussion only and may change at any moment.
	Its publication here does not imply endorsement of its contents by W3C.
	Don’t cite this document other than as work in progress. </p>
   <p> <a href="https://github.com/w3c/csswg-drafts/issues">GitHub Issues</a> are preferred for discussion of this specification.
	When filing an issue, please put the text “css-pseudo” in the title,
	preferably like this:
	“[css-pseudo] <i data-lt>…summary of comment…</i>”.
	All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>,
	and there is also a <a href="https://lists.w3.org/Archives/Public/www-style/">historical archive</a>. </p>
   <p> This document was produced by the <a href="https://www.w3.org/Style/CSS/">CSS Working Group</a>. </p>
   <p> This document was produced by a group operating under
	the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>.
	W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group;
	that page also includes instructions for disclosing a patent.
	An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
   <p> This document is governed by the <a href="https://www.w3.org/2019/Process-20190301/" id="w3c_process_revision">1 March 2019 W3C Process Document</a>. </p>
   <p></p>
  </div>
  <div data-fill-with="at-risk"></div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
    <li>
     <a href="#typographic-pseudos"><span class="secno">2</span> <span class="content"> Typographic Pseudo-elements</span></a>
     <ol class="toc">
      <li>
       <a href="#first-line-pseudo"><span class="secno">2.1</span> <span class="content"> The ::first-line pseudo-element</span></a>
       <ol class="toc">
        <li><a href="#first-text-line"><span class="secno">2.1.1</span> <span class="content"> Finding the First Formatted Line</span></a>
        <li><a href="#first-line-styling"><span class="secno">2.1.2</span> <span class="content"> Styling the First Line Pseudo-element</span></a>
        <li><a href="#first-line-inheritance"><span class="secno">2.1.3</span> <span class="content"> Inheritance and the <span class="css">::first-line</span> Pseudo-element</span></a>
       </ol>
      <li>
       <a href="#first-letter-pseudo"><span class="secno">2.2</span> <span class="content"> The ::first-letter pseudo-element</span></a>
       <ol class="toc">
        <li><a href="#first-letter-application"><span class="secno">2.2.1</span> <span class="content"> Finding the First Letter</span></a>
        <li><a href="#first-letter-styling"><span class="secno">2.2.2</span> <span class="content"> Styling the <span class="css">::first-letter</span> Pseudo-element</span></a>
       </ol>
     </ol>
    <li>
     <a href="#highlight-pseudos"><span class="secno">3</span> <span class="content"> Highlight Pseudo-elements</span></a>
     <ol class="toc">
      <li><a href="#highlight-selectors"><span class="secno">3.1</span> <span class="content"> Selecting Highlighted Content: the <span class="css">::selection</span>, <span class="css">::inactive-selection</span>, <span class="css">::spelling-error</span>, and <span class="css">::grammar-error</span> pseudo-elements</span></a>
      <li><a href="#highlight-styling"><span class="secno">3.2</span> <span class="content"> Styling Highlights</span></a>
      <li><a href="#highlight-bounds"><span class="secno">3.3</span> <span class="content"> Area of a Highlight</span></a>
      <li><a href="#highlight-cascade"><span class="secno">3.4</span> <span class="content"> Cascading and Per-Element Highlight Styles</span></a>
      <li><a href="#highlight-painting"><span class="secno">3.5</span> <span class="content"> Painting the Highlight</span></a>
      <li><a href="#highlight-security"><span class="secno">3.6</span> <span class="content"> Security and Privacy Considerations</span></a>
     </ol>
    <li>
     <a href="#treelike"><span class="secno">4</span> <span class="content"> Tree-Abiding Pseudo-elements</span></a>
     <ol class="toc">
      <li><a href="#generated-content"><span class="secno">4.1</span> <span class="content"> Generated Content Pseudo-elements: <span class="css">::before</span> and <span class="css">::after</span></span></a>
      <li><a href="#marker-pseudo"><span class="secno">4.2</span> <span class="content"> List Markers: the <span class="css">::marker</span> pseudo-element</span></a>
      <li><a href="#placeholder-pseudo"><span class="secno">4.3</span> <span class="content"> Placeholder Input: the <span class="css">::placeholder</span> pseudo-element</span></a>
     </ol>
    <li><a href="#interactions"><span class="secno">5</span> <span class="content"> Overlapping Pseudo-element Interactions</span></a>
    <li>
     <a href="#cssom"><span class="secno">6</span> <span class="content"> Additions to the CSS Object Model</span></a>
     <ol class="toc">
      <li><a href="#CSSPseudoElement-interface"><span class="secno">6.1</span> <span class="content"> <code class="idl"><span>CSSPseudoElement</span></code> Interface</span></a>
      <li><a href="#window-interface"><span class="secno">6.2</span> <span class="content"> <code class="idl"><span>pseudo()</span></code> method of the <code class="idl"><span>Element</span></code> interface</span></a>
     </ol>
    <li><a href="#css2-compat"><span class="secno">7</span> <span class="content"> Compatibilitiy Syntax</span></a>
    <li><a href="#changes"><span class="secno"></span> <span class="content"> Changes</span></a>
    <li><a href="#acknowledgements"><span class="secno"></span> <span class="content"> Acknowledgements</span></a>
    <li>
     <a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
     <ol class="toc">
      <li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
      <li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
      <li>
       <a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
       <ol class="toc">
        <li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
        <li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
        <li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
       </ol>
     </ol>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
    <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
   <p><em>This section is informative.</em></p>
   <p><a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#pseudo-element" id="ref-for-pseudo-element">Pseudo-elements</a> represent abstract elements of the document
  beyond those elements explicitly created by the document language.
  Since they are not restricted to fitting into the document tree,
  they can be used to select and style portions of the document
  that do not necessarily map to the document’s tree structure.
  For instance, the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line">::first-line</a> pseudo-element can
  select content on the first formatted line of an element <em>after</em> text wrapping,
  allowing just that line to be styled differently
  from the rest of the paragraph.</p>
   <p>Each pseudo-element is associated with an <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element">originating element</a> and has syntax of the form <span class="css">::name-of-pseudo</span>.
  This module defines the pseudo-elements that exist in CSS
  and how they can be styled.
  For more information on pseudo-elements in general,
  and on their syntax and interaction with other <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#selector" id="ref-for-selector">selectors</a>,
  see <a data-link-type="biblio" href="#biblio-selectors-4">[SELECTORS-4]</a>.</p>
   <h2 class="heading settled" data-level="2" id="typographic-pseudos"><span class="secno">2. </span><span class="content"> Typographic Pseudo-elements</span><a class="self-link" href="#typographic-pseudos"></a></h2>
   <h3 class="heading settled" data-level="2.1" id="first-line-pseudo"><span class="secno">2.1. </span><span class="content"> The ::first-line pseudo-element</span><a class="self-link" href="#first-line-pseudo"></a></h3>
   <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-first-line">::first-line</dfn> pseudo-element describes the contents of
  the <a data-link-type="dfn" href="#first-formatted-line" id="ref-for-first-formatted-line">first formatted line</a> of its <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①">originating element</a>.</p>
   <div class="example" id="example-d4c3a3da">
    <a class="self-link" href="#example-d4c3a3da"></a> The rule below means
    “change the letters of the first line of every <code class="highlight">p</code> element to uppercase”: 
<pre class="highlight"><c- f>p::first-line </c-><c- p>{</c-> <c- k>text-transform</c-><c- p>:</c-> uppercase <c- p>}</c-></pre>
    <p>The selector <span class="css">p::first-line</span> does not match any real document element.
    It does match a pseudo-element that conforming user agents
    will insert at the beginning of every <code class="highlight">p</code> element.</p>
   </div>
   <p class="note" role="note"><span>Note:</span> Note that the length of the first line depends on a number of factors,
  including the width of the page, the font size, etc.</p>
   <div class="example" id="example-855461d4">
    <a class="self-link" href="#example-855461d4"></a> For example, given an ordinary HTML <a data-link-type="biblio" href="#biblio-html5">[HTML5]</a> paragraph such as: 
<pre class="highlight">&lt;P>This is a somewhat long HTML
paragraph that will be broken into several
lines. The first line will be identified
by a fictional tag sequence. The other lines
will be treated as ordinary lines in the
paragraph.&lt;/P>
</pre>
    <p>The lines might be broken as follows:</p>
<pre class="highlight">THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
will be broken into several lines. The first
line will be identified by a fictional tag
sequence. The other lines will be treated as
ordinary lines in the paragraph.
</pre>
    <p>This paragraph might be “rewritten” by user agents
    to include a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fictional-tag-sequence">fictional tag sequence</dfn> to represent <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①">::first-line</a>.
    This <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence">fictional tag sequence</a> helps to show how properties are inherited.</p>
<pre class="highlight">&lt;P><b>&lt;P::first-line></b> This is a somewhat long HTML
paragraph that <b>&lt;/P::first-line></b> will be broken into several
lines. The first line will be identified
by a fictional tag sequence. The other lines
will be treated as ordinary lines in the
paragraph.&lt;/P>
</pre>
   </div>
   <p>If a pseudo-element breaks up a real element,
  the desired effect can often be described by a <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence①">fictional tag sequence</a> that closes and then re-opens the element.</p>
   <div class="example" id="example-d3e77da0">
    <a class="self-link" href="#example-d3e77da0"></a> Thus, if we mark up the previous paragraph with a <code class="highlight">span</code> element encompassing the first sentence: 
<pre class="highlight">&lt;P><b>&lt;SPAN class="test"></b> This is a somewhat long HTML
paragraph that will be broken into several
lines.<b>&lt;/SPAN></b> The first line will be identified
by a fictional tag sequence. The other lines
will be treated as ordinary lines in the
paragraph.&lt;/P>
</pre>
    <p>the user agent could simulate start and end tags for <code class="highlight">span</code> when inserting the <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence②">fictional tag sequence</a> for <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line②">::first-line</a> to get the correct inheritance behavior.</p>
<pre class="highlight">&lt;P>&lt;P::first-line><b>&lt;SPAN class="test"></b> This is a somewhat long HTML
paragraph that will <b>&lt;/SPAN></b>&lt;/P::first-line><b>&lt;SPAN class="test"></b> be broken into several
lines.<b>&lt;/SPAN></b> The first line will be identified
by a fictional tag sequence. The other lines
will be treated as ordinary lines in the
paragraph.&lt;/P>
</pre>
   </div>
   <h4 class="heading settled" data-level="2.1.1" id="first-text-line"><span class="secno">2.1.1. </span><span class="content"> Finding the First Formatted Line</span><a class="self-link" href="#first-text-line"></a></h4>
   <p>In CSS, the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line③">::first-line</a> pseudo-element
  can only have an effect when attached to a <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#block-container" id="ref-for-block-container">block container</a>.
  The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="first-formatted-line">first formatted line</dfn> of an element
  must occur inside a block-level descendant in the same flow
  (i.e., a block-level descendant that is not out-of-flow due to floating or positioning).</p>
   <div class="example" id="example-146d0917"><a class="self-link" href="#example-146d0917"></a> For example, the first line of the <code class="highlight">DIV</code> in <code class="highlight">&lt;DIV>&lt;P>This line...&lt;/P>&lt;/DIV></code> is the first line of the <code class="highlight">P</code> (assuming that both <code class="highlight">P</code> and <code class="highlight">DIV</code> are blocks). </div>
   <p>The first line of a table-cell or inline-block
  cannot be the first formatted line of an ancestor element.
  Thus, in <code class="highlight">&lt;DIV>&lt;P STYLE="display: inline-block">Hello&lt;BR>Goodbye&lt;/P> etcetera&lt;/DIV></code> the first formatted line of the <code class="highlight">DIV</code> is not the line "Hello".</p>
   <p class="note" role="note"><span>Note:</span> Note that the first line of the <code class="highlight">p</code> in this fragment: <code class="highlight">&lt;p>&lt;br>First...</code> doesn’t contain any letters (assuming the default style for <code class="highlight">br</code>).
  The word "First" is not on the first formatted line.</p>
   <p>A user agent must act as if the fictional start tags of a <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line④">::first-line</a> pseudo-element
  were nested just inside the innermost enclosing block-level element.</p>
   <div class="example" id="example-85d977f9">
    <a class="self-link" href="#example-85d977f9"></a> For example, the <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence③">fictional tag sequence</a> for 
<pre class="highlight">&lt;DIV>
  &lt;P>First paragraph&lt;/P>
  &lt;P>Second paragraph&lt;/P>
&lt;/DIV>
</pre>
    <p>is</p>
<pre class="highlight">&lt;DIV>
  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
&lt;/DIV>
</pre>
   </div>
   <h4 class="heading settled" data-level="2.1.2" id="first-line-styling"><span class="secno">2.1.2. </span><span class="content"> Styling the First Line Pseudo-element</span><a class="self-link" href="#first-line-styling"></a></h4>
   <p>The <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line⑤">::first-line</a> pseudo-element’s generated box
  behaves similar to that of an inline-level element, but with certain restrictions.
  The following CSS properties apply to a <span class="css" id="ref-for-selectordef-first-line⑥">::first-line</span> pseudo-element:</p>
   <ul>
    <li>all font properties (see <a data-link-type="biblio" href="#biblio-css-fonts-3">[CSS-FONTS-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity" id="ref-for-propdef-opacity">opacity</a> properties (see <a data-link-type="biblio" href="#biblio-css-color-3">[CSS-COLOR-3]</a>) 
    <li>all background properties (see <a data-link-type="biblio" href="#biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]</a>) 
    <li>any typesetting properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a>) 
    <li>all text decoration properties (see <a data-link-type="biblio" href="#biblio-css-text-decor-3">[CSS-TEXT-DECOR-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-ruby-1/#propdef-ruby-position" id="ref-for-propdef-ruby-position">ruby-position</a> property (see <a data-link-type="biblio" href="#biblio-css-ruby-1">[CSS-RUBY-1]</a>) 
    <li>any inline layout properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css-inline-3">[CSS-INLINE-3]</a>) 
    <li>any other properties defined to apply to <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line⑦">::first-line</a> by their respective specifications 
   </ul>
    User agents may apply other properties as well. 
   <h4 class="heading settled" data-level="2.1.3" id="first-line-inheritance"><span class="secno">2.1.3. </span><span class="content"> Inheritance and the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line⑧">::first-line</a> Pseudo-element</span><a class="self-link" href="#first-line-inheritance"></a></h4>
   <p>During CSS inheritance, the portion of a child element that occurs on the first line
  only inherits properties applicable to the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line⑨">::first-line</a> pseudo-element
  from the <span class="css" id="ref-for-selectordef-first-line①⓪">::first-line</span> pseudo-element.
  For all other properties inheritance is
  from the non-pseudo-element parent of the first line pseudo element.
  (The portion of a child element that does not occur on the first line
  always inherits from the parent of that child.)</p>
   <h3 class="heading settled" data-level="2.2" id="first-letter-pseudo"><span class="secno">2.2. </span><span class="content"> The ::first-letter pseudo-element</span><a class="self-link" href="#first-letter-pseudo"></a></h3>
   <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-first-letter">::first-letter</dfn> pseudo-element represents
  the first <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-letter-unit" id="ref-for-typographic-letter-unit">typographic letter unit</a> <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a> on the <a data-link-type="dfn" href="#first-formatted-line" id="ref-for-first-formatted-line①">first formatted line</a> of its <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element②">originating element</a>,
  if it is not preceded by any other content
  (such as images or inline tables) on its line.
  The <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter">::first-letter</a> pseudo-element can be used
  to create “initial caps” and “drop caps”,
  which are common typographic effects.</p>
   <div class="example" id="example-b4ed8f23">
    <a class="self-link" href="#example-b4ed8f23"></a> For example, the following rule creates a 2-line drop-letter
    on every paragraph following a level-2 header,
    using the <a class="property" data-link-type="propdesc">initial-letter</a> property defined in <a data-link-type="biblio" href="#biblio-css-inline-3">[CSS-INLINE-3]</a>: 
<pre class="highlight"><c- f>h2 + p::first-letter </c-><c- p>{</c-> <c- k>initial-letter</c-><c- p>:</c-> <c- m>2</c-><c- p>;</c-> <c- p>}</c->
</pre>
   </div>
   <p>Punctuation (i.e, characters that belong to the Punctuation (<code class="highlight">P*</code>) <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-general-category" id="ref-for-unicode-general-category">Unicode general category</a> <a data-link-type="biblio" href="#biblio-uax44">[UAX44]</a>)
  that precedes or follows the first <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-letter-unit" id="ref-for-typographic-letter-unit①">typographic letter unit</a> must also be included
  in the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①">::first-letter</a> pseudo-element.</p>
   <div class="figure"> <img alt="Quotes that precede the first letter should be included." src="images/first-letter2.gif"> </div>
   <p>As explained in <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a>,
  a <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-letter-unit" id="ref-for-typographic-letter-unit②">typographic letter unit</a> can include more than one Unicode codepoint.
  For example, combining characters must be kept with their base character.
  Also, languages may have additional rules
  about how to treat certain letter combinations.
  In Dutch, for example, if the letter combination "ij" appears at the beginning of an element,
  both letters should be considered within the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter②">::first-letter</a> pseudo-element. <a data-link-type="biblio" href="#biblio-uax29">[UAX29]</a> The UA should tailor its definition of <span id="ref-for-typographic-letter-unit③">typographic letter unit</span> to reflect the first-letter traditions of the <span class="css" id="ref-for-selectordef-first-letter③">::first-letter</span> pseudo-element’s <em>containing block</em>’s content language.</p>
   <p class="note" role="note"><span>Note:</span> Note that the first <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-letter-unit" id="ref-for-typographic-letter-unit④">typographic letter unit</a> may in fact
  be a digit, e.g., the “6” in “67 million dollars is a lot of money.”</p>
   <p>If the characters that would form the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter④">::first-letter</a> are not in the same element, such as <code class="highlight">‘T</code> in <code class="highlight">&lt;p>‘&lt;em>T...</code>,
  the user agent may create a <span class="css" id="ref-for-selectordef-first-letter⑤">::first-letter</span> pseudo-element
  from one of the elements, both elements, or simply not create a pseudo-element.
  Additionally, if the first letter(s) of the block
  are not at the start of the line (for example due to bidirectional reordering),
  then the user agent need not create the pseudo-element(s).</p>
   <p>The <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter⑥">::first-letter</a> pseudo-element is contained within any <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①①">::first-line</a> pseudo-elements, and thus inherits from <span class="css" id="ref-for-selectordef-first-line①②">::first-line</span>.</p>
   <h4 class="heading settled" data-level="2.2.1" id="first-letter-application"><span class="secno">2.2.1. </span><span class="content"> Finding the First Letter</span><a class="self-link" href="#first-letter-application"></a></h4>
   <p>The first letter must occur on the <a data-link-type="dfn" href="#first-formatted-line" id="ref-for-first-formatted-line②">first formatted line</a>.
  For example, in this HTML fragment: <code class="highlight">&lt;p>&lt;br>First...</code> the first line doesn’t contain any letters
  and <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter⑦">::first-letter</a> doesn’t match anything.
  In particular, it does not match the “F” of “First”.</p>
   <p>In CSS, the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter⑧">::first-letter</a> pseudo-element
  only applies to block containers. <span class="note">A future version of this specification
  may allow this pseudo-element to apply to more display types.</span> The <span class="css" id="ref-for-selectordef-first-letter⑨">::first-letter</span> pseudo-element can be used
  with all such elements that contain text,
  or that have a descendant in the same flow that contains text.
  A user agent should act as if the fictional start tag
  of the ::first-letter pseudo-element
  is just before the first text of the element,
  even if that first text is in a descendant.</p>
   <div class="example" id="example-ac59bbd6">
    <a class="self-link" href="#example-ac59bbd6"></a> Example:
    The <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence④">fictional tag sequence</a> for this HTML fragment: 
<pre class="highlight">&lt;div>
&lt;p>The first text.
</pre>
    <p>is:</p>
<pre class="highlight">&lt;div>
&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.
</pre>
   </div>
   <p>In CSS the first letter of a table-cell or inline-block
  cannot be the first letter of an ancestor element.
  Thus, in <code class="highlight">&lt;DIV>&lt;P STYLE="display: inline-block">Hello&lt;BR>Goodbye&lt;/P> etcetera&lt;/DIV></code> the first letter of the <code class="highlight">DIV</code> is not the letter "H".
  In fact, the <code class="highlight">DIV</code> doesn’t have a first letter.
  If an element is a list item (<a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display">display: list-item</a>),
  the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①⓪">::first-letter</a> applies
  to the first letter in the principal box <em>after</em> the marker.
  User-Agents may ignore <span class="css" id="ref-for-selectordef-first-letter①①">::first-letter</span> on list items with <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-lists-3/#propdef-list-style-position" id="ref-for-propdef-list-style-position">list-style-position: inside</a>.
  If an element has <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before">::before</a> or <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after">::after</a> content,
  the <span class="css" id="ref-for-selectordef-first-letter①②">::first-letter</span> applies to the first letter of the
  element <em>including</em> that content.</p>
   <div class="example" id="example-179a5087"><a class="self-link" href="#example-179a5087"></a> Example:
    After the rule <span class="css">p::before {content: "Note: "}</span>, the
    selector <span class="css">p::first-letter</span> matches the "N" of "Note". </div>
   <h4 class="heading settled" data-level="2.2.2" id="first-letter-styling"><span class="secno">2.2.2. </span><span class="content"> Styling the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①③">::first-letter</a> Pseudo-element</span><a class="self-link" href="#first-letter-styling"></a></h4>
   <p>In CSS a ::first-letter pseudo-element is similar to an inline-level element.
  The following properties that apply to <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①④">::first-letter</a> pseudo-elements:</p>
   <ul>
    <li>all font properties (see <a data-link-type="biblio" href="#biblio-css-fonts-3">[CSS-FONTS-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0①">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity" id="ref-for-propdef-opacity①">opacity</a> properties (see <a data-link-type="biblio" href="#biblio-css-color-3">[CSS-COLOR-3]</a>) 
    <li>all background properties (see <a data-link-type="biblio" href="#biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]</a>) 
    <li>any typesetting properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a>) 
    <li>all text decoration properties (see <a data-link-type="biblio" href="#biblio-css-text-decor-3">[CSS-TEXT-DECOR-3]</a>) 
    <li>any inline layout properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css-inline-3">[CSS-INLINE-3]</a>) 
    <li>margin and padding properties (see <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>) 
    <li>border properties and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-backgrounds-3/#propdef-box-shadow" id="ref-for-propdef-box-shadow">box-shadow</a> (see <a data-link-type="biblio" href="#biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]</a>) 
    <li>any other properties defined to apply to <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①⑤">::first-letter</a> by their respective specifications 
   </ul>
   <p>User agents may apply other properties as well.</p>
   <p class="note" role="note"><span>Note:</span> In previous levels of CSS,
  User Agents were allowed to choose a line height, width and height based on the shape of the letter,
  approximate font sizes,
  or to take the glyph outline into account when formatting.
  This possibility has been intentionally removed,
  as it proved to be a poor solution for the intended use case (Drop Caps),
  yet caused interoperability problems.</p>
   <div class="example" id="example-2bbb49de">
    <a class="self-link" href="#example-2bbb49de"></a> Example:
    This CSS and HTML example shows a possible rendering of an initial cap.
    Note that the fictional start tag of the first letter
    is inside the <span>span</span>,
    and thus the font weight of the first letter is normal,
    not bold as the <span>span</span>: 
<pre class="highlight"><c- f>p </c-><c- p>{</c-> <c- k>line-height</c-><c- p>:</c-> <c- m>1.1</c-> <c- p>}</c->
<c- f>p::first-letter </c-><c- p>{</c-> <c- k>font-size</c-><c- p>:</c-> <c- m>3</c-><c- l>em</c-><c- p>;</c-> <c- k>font-weight</c-><c- p>:</c-> normal <c- p>}</c->
<c- f>span </c-><c- p>{</c-> <c- k>font-weight</c-><c- p>:</c-> bold <c- p>}</c->
...
&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
Erbarremt over my en mijn benaeuwde vesten&lt;br>
En arme burgery, en op mijn volcx gebed&lt;br>
En dagelix geschrey de bange stad ontzet.
</pre>
    <div class="figure"> <img alt="Image illustrating the ::first-letter pseudo-element" src="images/initial-cap.png"> </div>
   </div>
   <div class="example" id="example-8f966c0e">
    <a class="self-link" href="#example-8f966c0e"></a> The following CSS will make a drop cap initial letter span about two lines: 
<pre class="highlight"><c- f>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"></c->
<c- f>&lt;HTML></c->
<c- f> &lt;HEAD></c->
<c- f>  &lt;TITLE>Drop cap initial letter&lt;/TITLE></c->
<c- f>  &lt;STYLE type="text/css"></c->
<c- f>   P               </c-><c- p>{</c-> <c- k>font-size</c-><c- p>:</c-> <c- m>12</c-><c- l>pt</c-><c- p>;</c-> <c- k>line-height</c-><c- p>:</c-> <c- m>1.2</c-> <c- p>}</c->
   <c- f>P::first-letter </c-><c- p>{</c-> <c- k>font-size</c-><c- p>:</c-> <c- m>200</c-><c- l>%</c-><c- p>;</c-> <c- k>font-weight</c-><c- p>:</c-> bold<c- p>;</c-> <c- k>float</c-><c- p>:</c-> left <c- p>}</c->
   <c- f>SPAN            </c-><c- p>{</c-> <c- k>text-transform</c-><c- p>:</c-> uppercase <c- p>}</c->
  &lt;/STYLE>
 &lt;/HEAD>
 &lt;BODY>
  &lt;P>&lt;SPAN>The first&lt;/SPAN> few words of an article
    in The Economist.&lt;/P>
 &lt;/BODY>
&lt;/HTML>
</pre>
    <p>This example might be formatted as follows:</p>
    <div class="figure"> <img alt="Image illustrating the combined effect of the ::first-letter
   and ::first-line pseudo-elements" src="images/first-letter.gif"> </div>
    <p>The <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence⑤">fictional tag sequence</a> is:</p>
<pre class="highlight">&lt;P>
  &lt;SPAN>
    &lt;P::first-letter>
      T
    &lt;/P::first-letter>he first
  &lt;/SPAN>
  few words of an article in the Economist.
&lt;/P>
</pre>
    <p>Note that the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①⑥">::first-letter</a> pseudo-element tags abut the
    content (i.e., the initial character), while the ::first-line
    pseudo-element start tag is inserted right after the start tag of the
    block element.</p>
   </div>
   <h2 class="heading settled" data-level="3" id="highlight-pseudos"><span class="secno">3. </span><span class="content"> Highlight Pseudo-elements</span><a class="self-link" href="#highlight-pseudos"></a></h2>
   <h3 class="heading settled" data-level="3.1" id="highlight-selectors"><span class="secno">3.1. </span><span class="content"> Selecting Highlighted Content: the <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection">::selection</a>, <a class="css" data-link-type="maybe" href="#selectordef-inactive-selection" id="ref-for-selectordef-inactive-selection">::inactive-selection</a>, <a class="css" data-link-type="maybe" href="#selectordef-spelling-error" id="ref-for-selectordef-spelling-error">::spelling-error</a>, and <a class="css" data-link-type="maybe" href="#selectordef-grammar-error" id="ref-for-selectordef-grammar-error">::grammar-error</a> pseudo-elements</span><a class="self-link" href="#highlight-selectors"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="highlight pseudo-element" id="highlight-pseudo-element">highlight pseudo-elements</dfn> represent portions of a document that have been given a particular status
  and are typically styled differently to indicate that status to the user.
  For example,
  selected portions of the document are typically highlighted
  (given alternate background and foreground colors, or a color wash)
  to indicate their selected status.
  The following <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element">highlight pseudo-elements</a> are defined:</p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-selection">::selection</dfn> 
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-inactive-selection">::inactive-selection</dfn> 
    <dd>
      The <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection①">::selection</a> and <a class="css" data-link-type="maybe" href="#selectordef-inactive-selection" id="ref-for-selectordef-inactive-selection①">::inactive-selection</a> pseudo-elements represent
      the portion of a document that has been selected
      as the target or object of some possible future user-agent operation(s).
      They apply, for example, to selected text within an editable text field,
      which would be copied by a copy operation or replaced by a paste operation. 
     <p><a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection②">::selection</a> applies to active selections,
      whereas <a class="css" data-link-type="maybe" href="#selectordef-inactive-selection" id="ref-for-selectordef-inactive-selection②">::inactive-selection</a> applies to inactive selections
      (e.g. when the document window is inactive and therefore not receiving events).</p>
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-spelling-error">::spelling-error</dfn> 
    <dd> The <a class="css" data-link-type="maybe" href="#selectordef-spelling-error" id="ref-for-selectordef-spelling-error①">::spelling-error</a> pseudo-element represents
      a portion of text that has been flagged by the user agent as misspelled. 
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-grammar-error">::grammar-error</dfn> 
    <dd> The <a class="css" data-link-type="maybe" href="#selectordef-grammar-error" id="ref-for-selectordef-grammar-error①">::grammar-error</a> pseudo-element represents
      a portion of text that has been flagged by the user agent as grammatically incorrect. 
   </dl>
   <p>The <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element①">highlight pseudo-elements</a> do not necessarily fit into the element tree,
  and can arbitrarily cross element boundaries without honoring its nesting structure.</p>
   <p>The following addition is made to the default UA stylesheet:</p>
<pre class="highlight"><code class="lang-css highlight"><c- c><c- c>/* Represent default spelling/grammar error styling in an adjustable way */</c-></c->
<c- f><c- f>:root::spelling-error </c-></c-><c- p><c- p>{</c-></c-> <c- k><c- k>text-decoration-line</c-></c-><c- p><c- p>:</c-></c-> spelling-error<c- p><c- p>;</c-></c-> <c- p><c- p>}</c-></c->
<c- f><c- f>:root::grammar-error  </c-></c-><c- p><c- p>{</c-></c-> <c- k><c- k>text-decoration-line</c-></c-><c- p><c- p>:</c-></c-> grammar-error<c- p><c- p>;</c-></c-> <c- p><c- p>}</c-></c->
<c- c><c- c>/* Ensure contrast on text with shadows */</c-></c->
<c- f><c- f>:root::selection      </c-></c-><c- p><c- p>{</c-></c-> <c- k><c- k>text-shadow</c-></c-><c- p><c- p>:</c-></c-> none<c- p><c- p>;</c-></c-> <c- p><c- p>}</c-></c->
</code></pre>
   <p class="note" role="note"><span>Note:</span> A future level of CSS may introduce ways to create
  custom highlight pseudo-elements.</p>
   <h3 class="heading settled" data-level="3.2" id="highlight-styling"><span class="secno">3.2. </span><span class="content"> Styling Highlights</span><a class="self-link" href="#highlight-styling"></a></h3>
   <p>The <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element②">highlight pseudo-elements</a> can only be styled
  by a limited set of properties that do not affect layout.
  The following properties apply to the <span id="ref-for-highlight-pseudo-element③">highlight pseudo-elements</span>:</p>
   <ul>
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0②">color</a> 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color" id="ref-for-propdef-background-color">background-color</a> 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-ui-4/#propdef-cursor" id="ref-for-propdef-cursor">cursor</a> 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-ui-4/#propdef-caret-color" id="ref-for-propdef-caret-color">caret-color</a> 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration" id="ref-for-propdef-text-decoration">text-decoration</a> and its associated properties 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow" id="ref-for-propdef-text-shadow">text-shadow</a> 
    <li><a class="property" data-link-type="propdesc" href="https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-color" id="ref-for-propdef-stroke-color">stroke-color</a>, <a class="property" data-link-type="propdesc" href="https://drafts.fxtf.org/fill-stroke-3/#propdef-fill-color" id="ref-for-propdef-fill-color">fill-color</a>, and <a class="property" data-link-type="propdesc" href="https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-width" id="ref-for-propdef-stroke-width">stroke-width</a> 
   </ul>
   <p class="issue" id="issue-6ca196f5"><a class="self-link" href="#issue-6ca196f5"></a> Are there any other properties that should be included here?</p>
   <p>The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0③">color</a> property specifies the color of both the text
  and all line decorations (underline, overline, line-through)
  and emphasis marks (<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis" id="ref-for-propdef-text-emphasis">text-emphasis</a>)
  applied to the text
  by the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element③">originating element</a> and its ancestors and descendants.</p>
   <p class="note" role="note"><span>Note:</span> Historically (and at the time of writing)
  only <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0④">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color" id="ref-for-propdef-background-color①">background-color</a> have been interoperably supported.</p>
   <h3 class="heading settled" data-level="3.3" id="highlight-bounds"><span class="secno">3.3. </span><span class="content"> Area of a Highlight</span><a class="self-link" href="#highlight-bounds"></a></h3>
   <p>For each type of highlighting (see <a href="#highlight-selectors">§ 3.1 Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a>)
  there exists a single <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="highlight-overlay">highlight overlay</dfn> for the entire document,
  the active portions of which are represented
  by the corresponding <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element④">highlight pseudo-element</a>.
  Each box owns the piece of the overlay corresponding to any text or replaced content
  directly contained by the box. </p>
   <ul>
    <li> For text, the corresponding overlay must cover at least the entire em box
      and may extend further above/below the em box to the line box edges.
      Spacing between two characters may also be part of the overlay area,
      in which case it belongs to the innermost element that contains both characters
      and is selected when both characters are selected. 
    <li> For replaced content, the associated overlay must cover at least the entire replaced object,
      and may extend outward to include the element’s entire content box. 
    <li> The overlay may also include other other areas within the border-box of an element;
      in this case, those areas belong to the innermost such element that contains the area. 
   </ul>
   <p class="issue" id="issue-13b80e20"><a class="self-link" href="#issue-13b80e20"></a> See <a href="http://lists.w3.org/Archives/Public/www-style/2008Nov/0022.html">F2F minutes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2008Oct/0268.html">dbaron’s message</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0247.html">Daniel’s thread</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0261.html">Gecko notes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0366.html">Opera notes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0280.html">Webkit notes</a></p>
   <p class="issue" id="issue-271a1b90"><a class="self-link" href="#issue-271a1b90"></a> Not sure if this is the correct way of describing the way things work.</p>
   <h3 class="heading settled" data-level="3.4" id="highlight-cascade"><span class="secno">3.4. </span><span class="content"> Cascading and Per-Element Highlight Styles</span><a class="self-link" href="#highlight-cascade"></a></h3>
   <p>Each element draws its own active portions of the <a data-link-type="dfn" href="#highlight-overlay" id="ref-for-highlight-overlay">highlight overlays</a>,
  which receives the styles specified by
  the corresponding <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element⑤">highlight pseudo-element</a> styles
  for which that element is the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element④">originating element</a>.
  When multiple styles conflict,
  the winning style is determined by the cascade.
  When any supported property is not given a value by the cascade,
  it’s value is determined by inheritance from
  the corresponding <span id="ref-for-highlight-pseudo-element⑥">highlight pseudo-element</span> of its <span id="ref-for-originating-element⑤">originating element</span>’s parent element
  (regardless of whether that property is an <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#inherited-property" id="ref-for-inherited-property">inherited property</a>).</p>
   <div class="example" id="example-c35bf49a">
    <a class="self-link" href="#example-c35bf49a"></a> For example, if the following rules were applied: 
<pre class="highlight"><c- f>p::selection      </c-><c- p>{</c-> <c- k>color</c-><c- p>:</c-> yellow<c- p>;</c-> <c- k>background</c-><c- p>:</c-> green<c- p>;</c-> <c- p>}</c->
<c- f>p > em::selection </c-><c- p>{</c-> <c- k>color</c-><c- p>:</c-> orange<c- p>;</c-> <c- p>}</c->
<c- f>em::selection     </c-><c- p>{</c-> <c- k>color</c-><c- p>:</c->    red<c- p>;</c-> <c- p>}</c->
</pre>
    <p>to the following markup:</p>
<pre class="highlight">&lt;p>Highlight this &lt;em>and this&lt;/em>.&lt;/p>
</pre>
    <p>The selection highlight would be green throughout,
    with yellow text outside the <code class="highlight">&lt;em></code> element
    and orange text inside it.</p>
   </div>
   <p class="advisement"> Authors wanting multiple selections styles should use <strong><span class="css">:root::selection</span></strong> for their document-wide selection style,
  since this will allow clean overriding in descendants. <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection③">::selection</a> alone applies to every element in the tree,
  overriding the more specific styles of any ancestors. </p>
   <div class="example" id="example-97480f68">
    <a class="self-link" href="#example-97480f68"></a> For example, if an author specified 
<pre class="highlight"><c- f>::selection          </c-><c- p>{</c-> <c- k>background</c-><c- p>:</c-> blue<c- p>;</c-> <c- p>}</c->
<c- f>p.warning::selection </c-><c- p>{</c-> <c- k>background</c-><c- p>:</c->  red<c- p>;</c-> <c- p>}</c->
</pre>
    <p>and the document included</p>
<pre class="highlight">&lt;p class="warning">Some &lt;strong>very important information&lt;/strong>&lt;/p>
</pre>
    <p>The highlight would be blue over “very important information”
    because the <code class="highlight">&lt;strong></code> element´s <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection④">::selection</a> also matches the <span class="css">::selection { background: blue; }</span> rule.
    (Remember that <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-3/#x" id="ref-for-x">*</a> is implied when a tag selector is missing.)
    The style rules that would give the intended behavior
    (red highlight within <code class="highlight">p.warning</code>, blue elsewhere) are</p>
<pre class="highlight"><c- f>:root::selection     </c-><c- p>{</c-> <c- k>background</c-><c- p>:</c-> blue<c- p>;</c-> <c- p>}</c->
<c- f>p.warning::selection </c-><c- p>{</c-> <c- k>background</c-><c- p>:</c->  red<c- p>;</c-> <c- p>}</c->
</pre>
   </div>
   <p>The UA should use the OS-default highlight colors for <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection⑤">::selection</a> when neither <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0⑤">color</a> nor <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color" id="ref-for-propdef-background-color②">background-color</a> has been specified by the author.</p>
   <p class="note" role="note"><span>Note:</span> This paired-cascading behavior
  does not allow using the normal cascade
  (i.g. <span class="css">:root::selection</span> rules in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#cascade-origin-ua" id="ref-for-cascade-origin-ua">UA style sheet</a>)
  to represent the OS default selection colors.
  However it has been interoperably implemented in browsers
  and is thus probably a Web-compatibility requirement.</p>
   <h3 class="heading settled" data-level="3.5" id="highlight-painting"><span class="secno">3.5. </span><span class="content"> Painting the Highlight</span><a class="self-link" href="#highlight-painting"></a></h3>
   <p>Each <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element⑦">highlight pseudo-element</a> draws its background
  over the corresponding portion of the <a data-link-type="dfn" href="#highlight-overlay" id="ref-for-highlight-overlay①">highlight overlay</a>,
  painting it
  immediately below any positioned descendants
  (i.e. just before step 8 in <a href="https://www.w3.org/TR/CSS21/zindex.html">CSS2.1§E.2</a>).
  The <a class="css" data-link-type="maybe" href="#selectordef-selection" id="ref-for-selectordef-selection⑥">::selection</a> overlay is drawn
  over the <a class="css" data-link-type="maybe" href="#selectordef-spelling-error" id="ref-for-selectordef-spelling-error②">::spelling-error</a> overlay
  which is drawn over the <a class="css" data-link-type="maybe" href="#selectordef-grammar-error" id="ref-for-selectordef-grammar-error②">::grammar-error</a> overlay.</p>
   <p>A <a data-link-type="dfn" href="#highlight-pseudo-element" id="ref-for-highlight-pseudo-element⑧">highlight pseudo-element</a> also suppresses the drawing of any selected text
  (and any text decorations applied to that text).
  Instead the topmost active <a data-link-type="dfn" href="#highlight-overlay" id="ref-for-highlight-overlay②">highlight overlay</a> redraws that text
  (and its decorations)
  over the <span id="ref-for-highlight-overlay③">highlight overlay</span> backgrounds
  using its own <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0⑥">color</a>,
  with <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-color/#currentcolor-def" id="ref-for-currentcolor-def">currentColor</a> on its <span class="property" id="ref-for-color0⑦">color</span> property representing the <span class="property" id="ref-for-color0⑧">color</span> of the next <span id="ref-for-highlight-pseudo-element⑨">highlight pseudo-element</span> layer below,
  falling back finally to that of the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element⑥">originating element</a> (the colors that would otherwise be used).
  Any text decorations introduced by each <span id="ref-for-highlight-pseudo-element①⓪">highlight pseudo-element</span> are stacked in the same order as their backgrounds
  over the text’s original decorations
  and are all drawn, in their own colors.</p>
   <p class="note" role="note"><span>Note:</span> The element’s own text decorations
  (both <a href="https://www.w3.org/TR/css-text-decor/#line-decoration">line decorations</a> and <a href="https://www.w3.org/TR/css-text-decor/#emphasis-marks">emphasis marks</a>)
  are thus drawn in the pseudo-element’s own <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0⑨">color</a> when that is not <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-color/#currentcolor-def" id="ref-for-currentcolor-def①">currentColor</a>,
  regardless of their original color or fill specifications.</p>
   <p class="issue" id="issue-d7a7fce8"><a class="self-link" href="#issue-d7a7fce8"></a> What should happen with text shadows?
  Drawing them in their original color is disconcerting if that color is not a shade of gray.
  Maybe if the overlay has a background, suppress any text shadows below it?</p>
   <p>For non-replaced content, the UA must honor the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0①⓪">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color" id="ref-for-propdef-background-color③">background-color</a> (including their alpha channels) as specified.
  However, for replaced content, the UA should create a semi-transparent wash
  to coat the content so that it can show through the selection.
  This wash should be of the specified <span class="property" id="ref-for-propdef-background-color④">background-color</span> if that is not <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-color-4/#valdef-color-transparent" id="ref-for-valdef-color-transparent">transparent</a>,
  else of the specified <span class="property" id="ref-for-color0①①">color</span>;
  however the UA may adjust the alpha channel.</p>
   <h3 class="heading settled" data-level="3.6" id="highlight-security"><span class="secno">3.6. </span><span class="content"> Security and Privacy Considerations</span><a class="self-link" href="#highlight-security"></a></h3>
   <p>Because the styling of spelling and grammar errors
  can leak information about the contents of a user’s dictionary
  (which can include the user’s name and even includes the contents of his/her address book!)
  UAs that implement <a class="css" data-link-type="maybe" href="#selectordef-spelling-error" id="ref-for-selectordef-spelling-error③">::spelling-error</a> and <a class="css" data-link-type="maybe" href="#selectordef-grammar-error" id="ref-for-selectordef-grammar-error③">::grammar-error</a> must prevent pages from being able to read
  the styling of such highlighted segments.</p>
   <h2 class="heading settled" data-level="4" id="treelike"><span class="secno">4. </span><span class="content"> Tree-Abiding Pseudo-elements</span><a class="self-link" href="#treelike"></a></h2>
   <p><dfn data-dfn-type="dfn" data-export data-lt="tree-abiding|tree-abiding pseudo-element" id="tree-abiding">Tree-abiding pseudo-elements<a class="self-link" href="#tree-abiding"></a></dfn> always fit within the box tree.
  They <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#inheritance" id="ref-for-inheritance">inherit</a> any inheritable properties from their <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element⑦">originating element</a>;
  non-inheritable properties take their <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#initial-value" id="ref-for-initial-value">initial values</a> as usual. <a data-link-type="biblio" href="#biblio-css-cascade-4">[CSS-CASCADE-4]</a></p>
   <h3 class="heading settled" data-level="4.1" id="generated-content"><span class="secno">4.1. </span><span class="content"> Generated Content Pseudo-elements: <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before①">::before</a> and <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after①">::after</a></span><a class="self-link" href="#generated-content"></a></h3>
   <p>When their computed <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-content-3/#propdef-content" id="ref-for-propdef-content">content</a> value is not <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-content-3/#valdef-content-none" id="ref-for-valdef-content-none">none</a>,
  these pseudo-elements generate boxes
  as if they were immediate children of their <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element⑧">originating element</a>,
  and can be styled exactly like any normal document-sourced element in the document tree.</p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-before">::before</dfn> 
    <dd>Represents a styleable child pseudo-element
    immediately before the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element⑨">originating element</a>’s actual content. 
    <dt><dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-after">::after</dfn> 
    <dd>Represents a styleable child pseudo-element
    immediately after the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①⓪">originating element</a>’s actual content. 
   </dl>
   <div class="example" id="example-1db24d2c">
    <a class="self-link" href="#example-1db24d2c"></a> For example, the following rule inserts the string “Note: ”
    before the content of every <code class="highlight">&lt;p></code> element
    whose <code class="highlight">class</code> attribute has the value <code class="highlight">note</code>: 
<pre class="highlight"><c- f>p.note::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"Note: "</c-> <c- p>}</c-></pre>
    <p>Since the initial value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display①">display</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-display-3/#valdef-display-inline" id="ref-for-valdef-display-inline">inline</a>,
    this will generate an inline box.
    Like other inline children of <code class="highlight">&lt;p></code>,
    it will participate in <code class="highlight">&lt;p></code>’s inline formatting context,
    potentially sharing a line with other content.</p>
   </div>
   <p>As with the content of regular elements,
  the generated content of <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before②">::before</a> and <span class="css">:after</span> pseudo-elements
  may be included in any <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①③">::first-line</a> and <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①⑦">::first-letter</a> pseudo-elements
  applied to its <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①①">originating element</a>.</p>
   <h3 class="heading settled" data-level="4.2" id="marker-pseudo"><span class="secno">4.2. </span><span class="content"> List Markers: the <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker">::marker</a> pseudo-element</span><a class="self-link" href="#marker-pseudo"></a></h3>
   <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-marker">::marker</dfn> pseudo-element represents
  the automatically generated <a data-link-type="dfn">marker box</a> of a <a data-link-type="dfn" href="https://drafts.csswg.org/css-lists-3/#list-item" id="ref-for-list-item">list item</a>.
  (See <a data-link-type="biblio" href="#biblio-css-display-3">[CSS-DISPLAY-3]</a> and <a data-link-type="biblio" href="#biblio-css-lists-3">[CSS-LISTS-3]</a>.)</p>
   <p>The following CSS properties apply to a <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker①">::marker</a> pseudo-element:</p>
   <ul>
    <li>all font properties (see <a data-link-type="biblio" href="#biblio-css-fonts-3">[CSS-FONTS-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-4/#propdef-white-space" id="ref-for-propdef-white-space">white-space</a> property (see <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0" id="ref-for-color0①②">color</a> property (see <a data-link-type="biblio" href="#biblio-css-color-3">[CSS-COLOR-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-4/#propdef-text-combine-upright" id="ref-for-propdef-text-combine-upright">text-combine-upright</a>, <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi" id="ref-for-propdef-unicode-bidi">unicode-bidi</a>, and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction">direction</a> properties (see <a data-link-type="biblio" href="#biblio-css-writing-modes-3">[CSS-WRITING-MODES-3]</a>) 
    <li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-content-3/#propdef-content" id="ref-for-propdef-content①">content</a> property (see <a data-link-type="biblio" href="#biblio-css-lists-3">[CSS-LISTS-3]</a>) 
   </ul>
   <p class="note" role="note"> It is expected that future specifications will extend this list of properties;
    however at the moment marker box layout is not fully defined,
    so only these properties are allowed. </p>
   <p>UAs must add the following rule to their default style sheet:</p>
<pre class="highlight"><c- f>::marker, ::before::marker, ::after::marker </c-><c- p>{</c->
  <c- k>unicode-bidi</c-><c- p>:</c-> isolate<c- p>;</c->
  <c- k>font-variant-numeric</c-><c- p>:</c-> tabular-nums<c- p>;</c->
<c- p>}</c->
</pre>
   <p class="note" role="note"><span>Note:</span> Although the <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker②">::marker</a> pseudo-element can represent
  the <a data-link-type="dfn">marker box</a> of a <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before③">::before</a> or <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after②">::after</a> pseudo-element,
  the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#compound" id="ref-for-compound">compound selector</a> <span class="css" id="ref-for-selectordef-marker③">::marker</span>,
  which expands to <span class="css">*::marker</span> <a data-link-type="biblio" href="#biblio-selectors-4">[SELECTORS-4]</a>,
  will not select these markers—<wbr>an <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①②">originating element</a> that is a <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#pseudo-element" id="ref-for-pseudo-element①">pseudo-element</a> needs to be explicitly specified in the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#selector" id="ref-for-selector①">selector</a>,
  e.g. <span class="css">::before::marker</span>.</p>
   <h3 class="heading settled" data-level="4.3" id="placeholder-pseudo"><span class="secno">4.3. </span><span class="content"> Placeholder Input: the <a class="css" data-link-type="maybe" href="#selectordef-placeholder" id="ref-for-selectordef-placeholder">::placeholder</a> pseudo-element</span><a class="self-link" href="#placeholder-pseudo"></a></h3>
   <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-placeholder">::placeholder</dfn> pseudo-element represents
  placeholder text in an input field:
  text that represents the input
  and provides a hint to the user on how to fill out the form.
  For example, a date-input field
  might have the placeholder text “YYYY/MM/DD”
  to clarify that numeric dates are to be entered in year-month-day order.</p>
   <p class="note" role="note"><span>Note:</span> There also exists a <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-4/#placeholder-shown-pseudo" id="ref-for-placeholder-shown-pseudo">:placeholder-shown</a> pseudo-<em>class</em>,
  which applies to (real) elements while they are showing placeholder text,
  and can be used to style such elements specially. <a class="css" data-link-type="maybe" href="#selectordef-placeholder" id="ref-for-selectordef-placeholder①">::placeholder</a> specifically selects
  a pseudo-element representing the placeholder <em>text</em>,
  and is thus relatively limited in its abilities.</p>
   <p>All properties that apply to the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①④">::first-line</a> pseudo-element
  also apply to the <a class="css" data-link-type="maybe" href="#selectordef-placeholder" id="ref-for-selectordef-placeholder②">::placeholder</a> pseudo-element.</p>
   <p>In interactive media, placeholder text is often hidden once the user has entered input;
  however this is not a requirement, and both the input value and the placeholder text may be visible simultaneously.
  The exact behavior is UA-defined.
  Note that in static media (such as print)
  placeholder text will be present even after the user has entered input.</p>
   <p class="issue" id="issue-1631f2fa"><a class="self-link" href="#issue-1631f2fa"></a> Authors seem to want <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-align" id="ref-for-propdef-text-align">text-align</a> on the list of supported properties.
  See e.g. <a href="http://css-tricks.com/almanac/selectors/p/placeholder/">comments here</a>.</p>
   <p class="note" role="note"><span>Note:</span> It’s been requested that <a class="css" data-link-type="maybe" href="#selectordef-placeholder" id="ref-for-selectordef-placeholder③">::placeholder</a> also refer to
  a placeholder which has a corresponding element in the element tree.
  It’s not clear how this should work, but it may be worth doing.
  See <a href="https://github.com/w3c/csswg-drafts/issues/2517">Issue 2417</a>.</p>
   <h2 class="heading settled" data-level="5" id="interactions"><span class="secno">5. </span><span class="content"> Overlapping Pseudo-element Interactions</span><a class="self-link" href="#interactions"></a></h2>
   <div class="example" id="overlapping-example">
    <a class="self-link" href="#overlapping-example"></a> Recall that 
    <ul>
     <li> the contents of <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before④">::before</a> and <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after③">::after</a> are selected
        exactly as if they were normal elements in the document source tree 
     <li> the <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter①⑧">::first-letter</a> boundaries are tightly wrapped around the first letter text,
        and <span class="css" id="ref-for-selectordef-first-letter①⑨">::first-letter</span> is constrained to exist solely on the first formatted line. 
     <li> the <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①⑤">::first-line</a> start is inserted just inside the containing block’s element boundary,
        and its end after the close of all content on the line 
    </ul>
    <p>The following CSS and HTML example
    illustrates how overlapping pseudo-elements interact:</p>
<pre class="lang-html highlight"><c- p>&lt;</c-><c- f>style</c-><c- p>></c->
<c- f>p</c-> <c- p>{</c-> <c- k>color</c-><c- p>:</c-> <c- kc>red</c-><c- p>;</c-> <c- k>font-size</c-><c- p>:</c-> <c- mi>12</c-><c- b>pt</c-> <c- p>}</c->
<c- f>p</c-><c- p>::</c-><c- nd>first-letter</c-> <c- p>{</c-> <c- k>color</c-><c- p>:</c-> <c- kc>green</c-><c- p>;</c-> <c- k>font-size</c-><c- p>:</c-> <c- mi>200</c-><c- b>%</c-> <c- p>}</c->
<c- f>p</c-><c- p>::</c-><c- nd>first-line</c-> <c- p>{</c-> <c- k>color</c-><c- p>:</c-> <c- kc>blue</c-> <c- p>}</c->
<c- p>&lt;/</c-><c- f>style</c-><c- p>></c->

<c- p>&lt;</c-><c- f>p</c-><c- p>></c->Some text that ends up on two lines<c- p>&lt;/</c-><c- f>p</c-><c- p>></c->
</pre>
    <p>The first letter of each P element will be green with a font size of ’24pt'.
    The rest of the first formatted line will be blue
    while the rest of the paragraph will be red.</p>
    <p>Assuming that a line break will occur before the word "ends",
    the <a data-link-type="dfn" href="#fictional-tag-sequence" id="ref-for-fictional-tag-sequence⑥">fictional tag sequence</a> for this fragment might be:</p>
<pre class="lang-html highlight"><c- p>&lt;</c-><c- f>p</c-><c- p>></c->
  <c- p>&lt;</c-><c- f>p::first-line</c-><c- p>></c->
    <c- p>&lt;</c-><c- f>p::first-letter</c-><c- p>></c->
      S
    <c- p>&lt;/</c-><c- f>p::first-letter</c-><c- p>></c->
    ome text that
  <c- p>&lt;/</c-><c- f>p::first-line</c-><c- p>></c->
  ends up on two lines
<c- p>&lt;/</c-><c- f>p</c-><c- p>></c->
</pre>
   </div>
   <h2 class="heading settled" data-level="6" id="cssom"><span class="secno">6. </span><span class="content"> Additions to the CSS Object Model</span><a class="self-link" href="#cssom"></a></h2>
   <h3 class="heading settled" data-level="6.1" id="CSSPseudoElement-interface"><span class="secno">6.1. </span><span class="content"> <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement">CSSPseudoElement</a></code> Interface</span><a class="self-link" href="#CSSPseudoElement-interface"></a></h3>
   <p>The <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement①">CSSPseudoElement</a></code> interface
  allows pseudo-elements to be event targets.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="csspseudoelement"><code class="highlight"><c- g>CSSPseudoElement</c-></code></dfn> : <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#eventtarget" id="ref-for-eventtarget"><c- n>EventTarget</c-></a> {
    <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssomstring" id="ref-for-cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-csspseudoelement-type" id="ref-for-dom-csspseudoelement-type"><c- g>type</c-></a>;
    <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#element" id="ref-for-element"><c- n>Element</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Element" href="#dom-csspseudoelement-element" id="ref-for-dom-csspseudoelement-element"><c- g>element</c-></a>;
};
</pre>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSPseudoElement" data-dfn-type="attribute" data-export id="dom-csspseudoelement-type"><code class="highlight">type</code></dfn> attribute
  is a string representing the type of the pseudo-element.
  This can be one of the following values:</p>
   <dl>
    <dt><code class="highlight">"::before"</code> 
    <dd>Represents the <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before⑤">::before</a> pseudo-element. 
    <dt><code class="highlight">"::after"</code> 
    <dd>Represents the <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after④">::after</a> pseudo-element. 
    <dt><code class="highlight">"::marker"</code> 
    <dd>Represents the <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker④">::marker</a> pseudo-element. 
   </dl>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSPseudoElement" data-dfn-type="attribute" data-export id="dom-csspseudoelement-element"><code class="highlight">element</code></dfn> attribute is the <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①③">originating element</a> of the pseudo-element.</p>
   <p class="note" role="note"><span>Note:</span> This interface may be extended in the future
  to other pseudo-element types
  and/or to allow setting style information
  through a <code class="idl"><a data-link-type="idl" href="https://drafts.csswg.org/cssom-1/#cssstyledeclaration" id="ref-for-cssstyledeclaration">CSSStyleDeclaration</a></code> <code class="highlight">style</code> attribute.
  The current functionality is limited
  to that which is needed to support <a data-link-type="biblio" href="#biblio-web-animations-1">[web-animations-1]</a>.</p>
   <h3 class="heading settled" data-level="6.2" id="window-interface"><span class="secno">6.2. </span><span class="content"> <code class="idl"><a data-link-type="idl" href="#dom-element-pseudo" id="ref-for-dom-element-pseudo">pseudo()</a></code> method of the <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#element" id="ref-for-element①">Element</a></code> interface</span><a class="self-link" href="#window-interface"></a></h3>
   <p>A new method is added to the <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#element" id="ref-for-element②">Element</a></code> interface to retrieve
  pseudo-elements created by a given element for a given type:</p>
<pre class="idl highlight def"><c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://dom.spec.whatwg.org/#element" id="ref-for-element③"><c- g>Element</c-></a> {
  <a class="n" data-link-type="idl-name" href="#csspseudoelement" id="ref-for-csspseudoelement②"><c- n>CSSPseudoElement</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-element-pseudo" id="ref-for-dom-element-pseudo①"><c- g>pseudo</c-></a>(<a class="n" data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssomstring" id="ref-for-cssomstring①"><c- n>CSSOMString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="Element/pseudo(type)" data-dfn-type="argument" data-export id="dom-element-pseudo-type-type"><code class="highlight"><c- g>type</c-></code></dfn>);
};
</pre>
   <div class="algorithm" data-algorithm="pseudo(CSSOMString type)">
     The <dfn class="dfn-paneled idl-code" data-dfn-for="Element" data-dfn-type="method" data-export data-lt="pseudo(type)" id="dom-element-pseudo" title="pseudo(type)"><code class="highlight">pseudo(CSSOMString type)</code></dfn> method
    is used to retrieve the <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement③">CSSPseudoElement</a></code> instance
    of the type matching <code class="idl"><a class="idl-code" data-link-type="argument" href="#dom-element-pseudo-type-type" id="ref-for-dom-element-pseudo-type-type">type</a></code> associated with the element.
    When it is called,
    execute the following steps: 
    <ol>
     <li data-md>
      <p><a data-link-type="dfn" href="https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar">Parse</a> the <code class="idl"><a class="idl-code" data-link-type="argument" href="#dom-element-pseudo-type-type" id="ref-for-dom-element-pseudo-type-type①">type</a></code> argument as a <a class="production css" data-link-type="type" href="https://drafts.csswg.org/selectors-4/#typedef-pseudo-element-selector" id="ref-for-typedef-pseudo-element-selector">&lt;pseudo-element-selector></a>,
and let <var>type</var> be the result.</p>
     <li data-md>
      <p>If <var>type</var> is failure,
return null.</p>
     <li data-md>
      <p>Otherwise, return the <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement④">CSSPseudoElement</a></code> object
representing the pseudo-element
that would match the selector <var>type</var> with <a data-link-type="dfn" href="https://heycam.github.io/webidl/#this" id="ref-for-this">this</a> as its <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①④">originating element</a>.</p>
    </ol>
   </div>
   <p>Return values that represent the same <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#pseudo-element" id="ref-for-pseudo-element②">pseudo-element</a> on the same <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#originating-element" id="ref-for-originating-element①⑤">originating element</a> must be, insofar as observable,
  always the same <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement⑤">CSSPseudoElement</a></code> object.
  (The UA may drop or regenerate the object for convenience or performance
  if this is not observable.)</p>
   <p class="issue" id="issue-302461e7"><a class="self-link" href="#issue-302461e7"></a> The identity, lifetime, and nullness of the return value
  (and potential error cases)
  of the <code class="idl"><a data-link-type="idl" href="#dom-element-pseudo" id="ref-for-dom-element-pseudo②">pseudo()</a></code> method is still under discussion.
  See <a href="https://github.com/w3c/csswg-drafts/issues/3607">Issue 3607</a> and <a href="https://github.com/w3c/csswg-drafts/issues/3603">Issue 3603</a>.</p>
   <h2 class="heading settled" data-level="7" id="css2-compat"><span class="secno">7. </span><span class="content"> Compatibilitiy Syntax</span><a class="self-link" href="#css2-compat"></a></h2>
   <p>For compatibility with existing style sheets written against CSS Level 2 <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>,
  user agents must also accept the previous one-colon notation
  (<code class="highlight">:before</code>, <code class="highlight">:after</code>, <code class="highlight">:first-letter</code>, <code class="highlight">:first-line</code>)
  for the <a class="css" data-link-type="maybe" href="#selectordef-before" id="ref-for-selectordef-before⑥">::before</a>, <a class="css" data-link-type="maybe" href="#selectordef-after" id="ref-for-selectordef-after⑤">::after</a>, <a class="css" data-link-type="maybe" href="#selectordef-first-letter" id="ref-for-selectordef-first-letter②⓪">::first-letter</a>, and <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①⑥">::first-line</a> pseudo-elements. </p>
   <h2 class="no-num heading settled" id="changes"><span class="content"> Changes</span><a class="self-link" href="#changes"></a></h2>
   <p>Changes since the <a href="https://www.w3.org/TR/2019/WD-css-pseudo-4-20190225/">25 February 2019 Working Draft</a> include:</p>
   <ul>
    <li>Added <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker⑤">::marker</a> to types allowed for <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement⑥">CSSPseudoElement</a></code> interface. 
    <li>Clarified return value of <code class="idl"><a data-link-type="idl" href="#dom-element-pseudo" id="ref-for-dom-element-pseudo③">pseudo()</a></code>. 
    <li>Added <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-content-3/#propdef-content" id="ref-for-propdef-content②">content</a>, <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi" id="ref-for-propdef-unicode-bidi①">unicode-bidi</a>, and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction①">direction</a> to properties allowed on <a class="css" data-link-type="maybe" href="#selectordef-marker" id="ref-for-selectordef-marker⑥">::marker</a>. 
    <li>Added <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-ruby-1/#propdef-ruby-position" id="ref-for-propdef-ruby-position①">ruby-position</a> to properties allowed on <a class="css" data-link-type="maybe" href="#selectordef-first-line" id="ref-for-selectordef-first-line①⑦">::first-line</a>,
    analogous with <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position" id="ref-for-propdef-text-emphasis-position">text-emphasis-position</a>.
    (<a href="https://github.com/w3c/csswg-drafts/issues/2998">Issue 2998</a>) 
   </ul>
   <p>Changes since the <a href="https://www.w3.org/TR/2016/WD-css-pseudo-4-20160607/">7 June 2016 Working Draft</a> include:</p>
   <ul>
    <li>Specified <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-text-decor-4/#valdef-text-tecoration-line-spelling-error" id="ref-for-valdef-text-tecoration-line-spelling-error">spelling-error</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-text-decor-4/#valdef-text-decoration-line-grammar-error" id="ref-for-valdef-text-decoration-line-grammar-error">grammar-error</a> with <a class="css" data-link-type="maybe" href="#selectordef-spelling-error" id="ref-for-selectordef-spelling-error④">::spelling-error</a> and <a class="css" data-link-type="maybe" href="#selectordef-grammar-error" id="ref-for-selectordef-grammar-error④">::grammar-error</a> in the UA stylesheet. 
    <li>Redefined value propagation between parent/child highlight pseudo-elements to use inheritance rather than cascading. See discussion in and linked from <a href="https://github.com/w3c/csswg-drafts/issues/2474">Issue 2474</a>. 
    <li>Refined list of supported properties for highlight pseudo-elements, e.g. adding <a class="property" data-link-type="propdesc" href="https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-color" id="ref-for-propdef-stroke-color①">stroke-color</a>/<a class="property" data-link-type="propdesc" href="https://drafts.fxtf.org/fill-stroke-3/#propdef-fill-color" id="ref-for-propdef-fill-color①">fill-color</a>, removing <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-ui-4/#propdef-outline" id="ref-for-propdef-outline">outline</a>, etc. 
    <li>Clarified how text and text decoration colors are painted for highlight pseudo-elements. 
    <li>Added the <code class="idl"><a data-link-type="idl" href="#dom-csspseudoelement-element" id="ref-for-dom-csspseudoelement-element①">element</a></code> attribute to the <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement⑦">CSSPseudoElement</a></code> interface. 
    <li>Changed the values of the <code class="idl"><a data-link-type="idl" href="#dom-csspseudoelement-type" id="ref-for-dom-csspseudoelement-type①">type</a></code> attribute on the <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement⑧">CSSPseudoElement</a></code> interface to match the corresponding pseudo-elements. 
    <li>Reduced supported types of <code class="idl"><a data-link-type="idl" href="#csspseudoelement" id="ref-for-csspseudoelement⑨">CSSPseudoElement</a></code> and removed unimplemented <code class="highlight">style</code> attribute. 
    <li>Changed <code class="highlight">window.getPseudoElements(elem,type)</code> to <code class="highlight">Element.pseudo(type)</code>. 
    <li>Miscellaneous minor clarifications and fixes. 
   </ul>
   <h2 class="no-num heading settled" id="acknowledgements"><span class="content"> Acknowledgements</span><a class="self-link" href="#acknowledgements"></a></h2>
   <p>The editors would like to thank the following individuals for their
  contributions, either during the conception of the specification or during
  its development and specification review process:
  Tab Atkins,
  David Baron,
  Razvan Caliman,
  Chris Coyier,
  Anders Grimsrud,
  Vincent Hardy.</p>
  </main>
  <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
  <h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
  <p>Conformance requirements are expressed with a combination of
	descriptive assertions and RFC 2119 terminology. The key words “MUST”,
	“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
	“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
	document are to be interpreted as described in RFC 2119.
	However, for readability, these words do not appear in all uppercase
	letters in this specification. </p>
  <p>All of the text of this specification is normative except sections
	explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
  <p>Examples in this specification are introduced with the words “for example”
	or are set apart from the normative text with <code class="highlight">class="example"</code>,
	like this: </p>
  <div class="example" id="example-ae2b6bc0">
   <a class="self-link" href="#example-ae2b6bc0"></a> 
   <p>This is an example of an informative example. </p>
  </div>
  <p>Informative notes begin with the word “Note” and are set apart from the
	normative text with <code class="highlight">class="note"</code>, like this: </p>
  <p class="note" role="note">Note, this is an informative note. </p>
  <p>Advisements are normative sections styled to evoke special attention and are
	set apart from other normative text with <code class="highlight">&lt;strong class="advisement"></code>, like
	this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
  <h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
  <p>Conformance to this specification
	is defined for three conformance classes: </p>
  <dl>
   <dt>style sheet 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
			style sheet</a>. 
   <dt>renderer 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
			documents that use them. 
   <dt>authoring tool 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet. 
  </dl>
  <p>A style sheet is conformant to this specification
	if all of its statements that use syntax defined in this module are valid
	according to the generic CSS grammar and the individual grammars of each
	feature defined in this module. </p>
  <p>A renderer is conformant to this specification
	if, in addition to interpreting the style sheet as defined by the
	appropriate specifications, it supports all the features defined
	by this specification by parsing them correctly
	and rendering the document accordingly. However, the inability of a
	UA to correctly render a document due to limitations of the device
	does not make the UA non-conformant. (For example, a UA is not
	required to render color on a monochrome monitor.) </p>
  <p>An authoring tool is conformant to this specification
	if it writes style sheets that are syntactically correct according to the
	generic CSS grammar and the individual grammars of each feature in
	this module, and meet all other conformance requirements of style sheets
	as described in this module. </p>
  <h3 class="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3>
  <p>The following sections define several conformance requirements
		for implementing CSS responsibly,
		in a way that promotes interoperability in the present and future. </p>
  <h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4>
  <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid
		(and <a href="http://www.w3.org/TR/CSS2/conform.html#ignore">ignore as appropriate</a>)
		any at-rules, properties, property values, keywords, and other syntactic constructs
		for which they have no usable level of support</strong>.
		In particular, user agents <em>must not</em> selectively ignore
		unsupported property values and honor supported values in a single multi-value property declaration:
		if any value is considered invalid (as unsupported values must be),
		CSS requires that the entire declaration be ignored. </p>
  <h4 class="heading settled" id="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4>
  <p>To avoid clashes with future stable CSS features,
		the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p>
  <h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4>
  <p>Once a specification reaches the Candidate Recommendation stage,
		implementers should release an <a data-link-type="dfn" href="http://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation
		of any CR-level feature they can demonstrate
		to be correctly implemented according to spec,
		and should avoid exposing a prefixed variant of that feature. </p>
  <p>To establish and maintain the interoperability of CSS across
		implementations, the CSS Working Group requests that non-experimental
		CSS renderers submit an implementation report (and, if necessary, the
		testcases used for that implementation report) to the W3C before
		releasing an unprefixed implementation of any CSS features. Testcases
		submitted to W3C are subject to review and correction by the CSS
		Working Group. </p>
  <p>
   Further information on submitting testcases and implementation reports
		can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
		Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list. 
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
  </p>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#selectordef-after">::after</a><span>, in §4.1</span>
   <li><a href="#selectordef-before">::before</a><span>, in §4.1</span>
   <li><a href="#csspseudoelement">CSSPseudoElement</a><span>, in §6.1</span>
   <li><a href="#dom-csspseudoelement-element">element</a><span>, in §6.1</span>
   <li><a href="#fictional-tag-sequence">fictional tag sequence</a><span>, in §2.1</span>
   <li><a href="#first-formatted-line">first formatted line</a><span>, in §2.1.1</span>
   <li><a href="#selectordef-first-letter">::first-letter</a><span>, in §2.2</span>
   <li><a href="#selectordef-first-line">::first-line</a><span>, in §2.1</span>
   <li><a href="#selectordef-grammar-error">::grammar-error</a><span>, in §3.1</span>
   <li><a href="#highlight-overlay">highlight overlay</a><span>, in §3.3</span>
   <li><a href="#highlight-pseudo-element">highlight pseudo-element</a><span>, in §3.1</span>
   <li><a href="#selectordef-inactive-selection">::inactive-selection</a><span>, in §3.1</span>
   <li><a href="#selectordef-marker">::marker</a><span>, in §4.2</span>
   <li><a href="#selectordef-placeholder">::placeholder</a><span>, in §4.3</span>
   <li><a href="#dom-element-pseudo">pseudo(type)</a><span>, in §6.2</span>
   <li><a href="#selectordef-selection">::selection</a><span>, in §3.1</span>
   <li><a href="#selectordef-spelling-error">::spelling-error</a><span>, in §3.1</span>
   <li><a href="#tree-abiding">tree-abiding</a><span>, in §4</span>
   <li><a href="#tree-abiding">tree-abiding pseudo-element</a><span>, in §4</span>
   <li><a href="#dom-csspseudoelement-type">type</a><span>, in §6.1</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-propdef-background-color">
   <a href="https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color">https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-background-color">3.2. 
Styling Highlights</a> <a href="#ref-for-propdef-background-color①">(2)</a>
    <li><a href="#ref-for-propdef-background-color②">3.4. 
Cascading and Per-Element Highlight Styles</a>
    <li><a href="#ref-for-propdef-background-color③">3.5. 
Painting the Highlight</a> <a href="#ref-for-propdef-background-color④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-box-shadow">
   <a href="https://drafts.csswg.org/css-backgrounds-3/#propdef-box-shadow">https://drafts.csswg.org/css-backgrounds-3/#propdef-box-shadow</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-box-shadow">2.2.2. 
Styling the ::first-letter Pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-inheritance">
   <a href="https://drafts.csswg.org/css-cascade-4/#inheritance">https://drafts.csswg.org/css-cascade-4/#inheritance</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-inheritance">4. 
Tree-Abiding Pseudo-elements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-inherited-property">
   <a href="https://drafts.csswg.org/css-cascade-4/#inherited-property">https://drafts.csswg.org/css-cascade-4/#inherited-property</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-inherited-property">3.4. 
Cascading and Per-Element Highlight Styles</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-initial-value">
   <a href="https://drafts.csswg.org/css-cascade-4/#initial-value">https://drafts.csswg.org/css-cascade-4/#initial-value</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-initial-value">4. 
Tree-Abiding Pseudo-elements</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-cascade-origin-ua">
   <a href="https://drafts.csswg.org/css-cascade-4/#cascade-origin-ua">https://drafts.csswg.org/css-cascade-4/#cascade-origin-ua</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-cascade-origin-ua">3.4. 
Cascading and Per-Element Highlight Styles</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-color0">
   <a href="https://drafts.csswg.org/css-color-3/#color0">https://drafts.csswg.org/css-color-3/#color0</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-color0">2.1.2. 
Styling the First Line Pseudo-element</a>
    <li><a href="#ref-for-color0①">2.2.2. 
Styling the ::first-letter Pseudo-element</a>
    <li><a href="#ref-for-color0②">3.2. 
Styling Highlights</a> <a href="#ref-for-color0③">(2)</a> <a href="#ref-for-color0④">(3)</a>
    <li><a href="#ref-for-color0⑤">3.4. 
Cascading and Per-Element Highlight Styles</a>
    <li><a href="#ref-for-color0⑥">3.5. 
Painting the Highlight</a> <a href="#ref-for-color0⑦">(2)</a> <a href="#ref-for-color0⑧">(3)</a> <a href="#ref-for-color0⑨">(4)</a> <a href="#ref-for-color0①⓪">(5)</a> <a href="#ref-for-color0①①">(6)</a>
    <li><a href="#ref-for-color0①②">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-currentcolor-def">
   <a href="https://www.w3.org/TR/css3-color/#currentcolor-def">https://www.w3.org/TR/css3-color/#currentcolor-def</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-currentcolor-def">3.5. 
Painting the Highlight</a> <a href="#ref-for-currentcolor-def①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-opacity">
   <a href="https://drafts.csswg.org/css-color-4/#propdef-opacity">https://drafts.csswg.org/css-color-4/#propdef-opacity</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-opacity">2.1.2. 
Styling the First Line Pseudo-element</a>
    <li><a href="#ref-for-propdef-opacity①">2.2.2. 
Styling the ::first-letter Pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-color-transparent">
   <a href="https://drafts.csswg.org/css-color-4/#valdef-color-transparent">https://drafts.csswg.org/css-color-4/#valdef-color-transparent</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-color-transparent">3.5. 
Painting the Highlight</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-content">
   <a href="https://drafts.csswg.org/css-content-3/#propdef-content">https://drafts.csswg.org/css-content-3/#propdef-content</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-content">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
    <li><a href="#ref-for-propdef-content①">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-propdef-content②"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-content-none">
   <a href="https://drafts.csswg.org/css-content-3/#valdef-content-none">https://drafts.csswg.org/css-content-3/#valdef-content-none</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-content-none">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-block-container">
   <a href="https://drafts.csswg.org/css-display-3/#block-container">https://drafts.csswg.org/css-display-3/#block-container</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-block-container">2.1.1. 
Finding the First Formatted Line</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-display">
   <a href="https://drafts.csswg.org/css-display-3/#propdef-display">https://drafts.csswg.org/css-display-3/#propdef-display</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-display">2.2.1. 
Finding the First Letter</a>
    <li><a href="#ref-for-propdef-display①">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-display-inline">
   <a href="https://drafts.csswg.org/css-display-3/#valdef-display-inline">https://drafts.csswg.org/css-display-3/#valdef-display-inline</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-display-inline">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-item">
   <a href="https://drafts.csswg.org/css-lists-3/#list-item">https://drafts.csswg.org/css-lists-3/#list-item</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-item">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-list-style-position">
   <a href="https://drafts.csswg.org/css-lists-3/#propdef-list-style-position">https://drafts.csswg.org/css-lists-3/#propdef-list-style-position</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-list-style-position">2.2.1. 
Finding the First Letter</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-ruby-position">
   <a href="https://drafts.csswg.org/css-ruby-1/#propdef-ruby-position">https://drafts.csswg.org/css-ruby-1/#propdef-ruby-position</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-ruby-position">2.1.2. 
Styling the First Line Pseudo-element</a>
    <li><a href="#ref-for-propdef-ruby-position①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-css-parse-something-according-to-a-css-grammar">
   <a href="https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar">https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-css-parse-something-according-to-a-css-grammar">6.2. 
pseudo() method of the Element interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-align">
   <a href="https://drafts.csswg.org/css-text-3/#propdef-text-align">https://drafts.csswg.org/css-text-3/#propdef-text-align</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-align">4.3. 
Placeholder Input: the ::placeholder pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-typographic-letter-unit">
   <a href="https://drafts.csswg.org/css-text-3/#typographic-letter-unit">https://drafts.csswg.org/css-text-3/#typographic-letter-unit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typographic-letter-unit">2.2. 
The ::first-letter pseudo-element</a> <a href="#ref-for-typographic-letter-unit①">(2)</a> <a href="#ref-for-typographic-letter-unit②">(3)</a> <a href="#ref-for-typographic-letter-unit③">(4)</a> <a href="#ref-for-typographic-letter-unit④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-unicode-general-category">
   <a href="https://drafts.csswg.org/css-text-3/#unicode-general-category">https://drafts.csswg.org/css-text-3/#unicode-general-category</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-unicode-general-category">2.2. 
The ::first-letter pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-white-space">
   <a href="https://drafts.csswg.org/css-text-4/#propdef-white-space">https://drafts.csswg.org/css-text-4/#propdef-white-space</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-white-space">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-decoration">
   <a href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration">https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-decoration">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-emphasis">
   <a href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis">https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-emphasis">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-emphasis-position">
   <a href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position">https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-emphasis-position"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-shadow">
   <a href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow">https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-shadow">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-text-decoration-line-grammar-error">
   <a href="https://drafts.csswg.org/css-text-decor-4/#valdef-text-decoration-line-grammar-error">https://drafts.csswg.org/css-text-decor-4/#valdef-text-decoration-line-grammar-error</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-text-decoration-line-grammar-error"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-text-tecoration-line-spelling-error">
   <a href="https://drafts.csswg.org/css-text-decor-4/#valdef-text-tecoration-line-spelling-error">https://drafts.csswg.org/css-text-decor-4/#valdef-text-tecoration-line-spelling-error</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-text-tecoration-line-spelling-error"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-caret-color">
   <a href="https://drafts.csswg.org/css-ui-4/#propdef-caret-color">https://drafts.csswg.org/css-ui-4/#propdef-caret-color</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-caret-color">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-cursor">
   <a href="https://drafts.csswg.org/css-ui-4/#propdef-cursor">https://drafts.csswg.org/css-ui-4/#propdef-cursor</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-cursor">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-outline">
   <a href="https://drafts.csswg.org/css-ui-4/#propdef-outline">https://drafts.csswg.org/css-ui-4/#propdef-outline</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-outline"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-direction">
   <a href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction">https://drafts.csswg.org/css-writing-modes-3/#propdef-direction</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-direction">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-propdef-direction①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-unicode-bidi">
   <a href="https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi">https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-unicode-bidi">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-propdef-unicode-bidi①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-combine-upright">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#propdef-text-combine-upright">https://drafts.csswg.org/css-writing-modes-4/#propdef-text-combine-upright</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-combine-upright">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-cssomstring">
   <a href="https://drafts.csswg.org/cssom-1/#cssomstring">https://drafts.csswg.org/cssom-1/#cssomstring</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-cssomstring">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-cssomstring①">6.2. 
pseudo() method of the Element interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-cssstyledeclaration">
   <a href="https://drafts.csswg.org/cssom-1/#cssstyledeclaration">https://drafts.csswg.org/cssom-1/#cssstyledeclaration</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-cssstyledeclaration">6.1. 
CSSPseudoElement Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-element">
   <a href="https://dom.spec.whatwg.org/#element">https://dom.spec.whatwg.org/#element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-element">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-element①">6.2. 
pseudo() method of the Element interface</a> <a href="#ref-for-element②">(2)</a> <a href="#ref-for-element③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-eventtarget">
   <a href="https://dom.spec.whatwg.org/#eventtarget">https://dom.spec.whatwg.org/#eventtarget</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eventtarget">6.1. 
CSSPseudoElement Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-fill-color">
   <a href="https://drafts.fxtf.org/fill-stroke-3/#propdef-fill-color">https://drafts.fxtf.org/fill-stroke-3/#propdef-fill-color</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-fill-color">3.2. 
Styling Highlights</a>
    <li><a href="#ref-for-propdef-fill-color①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-stroke-color">
   <a href="https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-color">https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-color</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-stroke-color">3.2. 
Styling Highlights</a>
    <li><a href="#ref-for-propdef-stroke-color①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-stroke-width">
   <a href="https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-width">https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-width</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-stroke-width">3.2. 
Styling Highlights</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-x">
   <a href="https://drafts.csswg.org/selectors-3/#x">https://drafts.csswg.org/selectors-3/#x</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-x">3.4. 
Cascading and Per-Element Highlight Styles</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-placeholder-shown-pseudo">
   <a href="https://drafts.csswg.org/selectors-4/#placeholder-shown-pseudo">https://drafts.csswg.org/selectors-4/#placeholder-shown-pseudo</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-placeholder-shown-pseudo">4.3. 
Placeholder Input: the ::placeholder pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-typedef-pseudo-element-selector">
   <a href="https://drafts.csswg.org/selectors-4/#typedef-pseudo-element-selector">https://drafts.csswg.org/selectors-4/#typedef-pseudo-element-selector</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typedef-pseudo-element-selector">6.2. 
pseudo() method of the Element interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-compound">
   <a href="https://drafts.csswg.org/selectors-4/#compound">https://drafts.csswg.org/selectors-4/#compound</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-compound">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-originating-element">
   <a href="https://drafts.csswg.org/selectors-4/#originating-element">https://drafts.csswg.org/selectors-4/#originating-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-originating-element">1. Introduction</a>
    <li><a href="#ref-for-originating-element①">2.1. 
The ::first-line pseudo-element</a>
    <li><a href="#ref-for-originating-element②">2.2. 
The ::first-letter pseudo-element</a>
    <li><a href="#ref-for-originating-element③">3.2. 
Styling Highlights</a>
    <li><a href="#ref-for-originating-element④">3.4. 
Cascading and Per-Element Highlight Styles</a> <a href="#ref-for-originating-element⑤">(2)</a>
    <li><a href="#ref-for-originating-element⑥">3.5. 
Painting the Highlight</a>
    <li><a href="#ref-for-originating-element⑦">4. 
Tree-Abiding Pseudo-elements</a>
    <li><a href="#ref-for-originating-element⑧">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a> <a href="#ref-for-originating-element⑨">(2)</a> <a href="#ref-for-originating-element①⓪">(3)</a> <a href="#ref-for-originating-element①①">(4)</a>
    <li><a href="#ref-for-originating-element①②">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-originating-element①③">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-originating-element①④">6.2. 
pseudo() method of the Element interface</a> <a href="#ref-for-originating-element①⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-pseudo-element">
   <a href="https://drafts.csswg.org/selectors-4/#pseudo-element">https://drafts.csswg.org/selectors-4/#pseudo-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-pseudo-element">1. Introduction</a>
    <li><a href="#ref-for-pseudo-element①">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-pseudo-element②">6.2. 
pseudo() method of the Element interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-selector">
   <a href="https://drafts.csswg.org/selectors-4/#selector">https://drafts.csswg.org/selectors-4/#selector</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selector">1. Introduction</a>
    <li><a href="#ref-for-selector①">4.2. 
List Markers: the ::marker pseudo-element</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-Exposed">
   <a href="https://heycam.github.io/webidl/#Exposed">https://heycam.github.io/webidl/#Exposed</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-Exposed">6.1. 
CSSPseudoElement Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-this">
   <a href="https://heycam.github.io/webidl/#this">https://heycam.github.io/webidl/#this</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-this">6.2. 
pseudo() method of the Element interface</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[CSS-BACKGROUNDS-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-background-color" style="color:initial">background-color</span>
     <li><span class="dfn-paneled" id="term-for-propdef-box-shadow" style="color:initial">box-shadow</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-CASCADE-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-inheritance" style="color:initial">inheritance</span>
     <li><span class="dfn-paneled" id="term-for-inherited-property" style="color:initial">inherited property</span>
     <li><span class="dfn-paneled" id="term-for-initial-value" style="color:initial">initial value</span>
     <li><span class="dfn-paneled" id="term-for-cascade-origin-ua" style="color:initial">ua style sheet</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-COLOR-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-color0" style="color:initial">color</span>
     <li><span class="dfn-paneled" id="term-for-currentcolor-def" style="color:initial">currentcolor</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-color-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-opacity" style="color:initial">opacity</span>
     <li><span class="dfn-paneled" id="term-for-valdef-color-transparent" style="color:initial">transparent</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-content-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-content" style="color:initial">content</span>
     <li><span class="dfn-paneled" id="term-for-valdef-content-none" style="color:initial">none</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-DISPLAY-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-block-container" style="color:initial">block container</span>
     <li><span class="dfn-paneled" id="term-for-propdef-display" style="color:initial">display</span>
     <li><span class="dfn-paneled" id="term-for-valdef-display-inline" style="color:initial">inline</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-LISTS-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-list-item" style="color:initial">list item</span>
     <li><span class="dfn-paneled" id="term-for-propdef-list-style-position" style="color:initial">list-style-position</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-RUBY-1]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-ruby-position" style="color:initial">ruby-position</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-syntax-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-css-parse-something-according-to-a-css-grammar" style="color:initial">parse</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-TEXT-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-text-align" style="color:initial">text-align</span>
     <li><span class="dfn-paneled" id="term-for-typographic-letter-unit" style="color:initial">typographic letter unit</span>
     <li><span class="dfn-paneled" id="term-for-unicode-general-category" style="color:initial">unicode general category</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-text-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-white-space" style="color:initial">white-space</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-TEXT-DECOR-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-text-decoration" style="color:initial">text-decoration</span>
     <li><span class="dfn-paneled" id="term-for-propdef-text-emphasis" style="color:initial">text-emphasis</span>
     <li><span class="dfn-paneled" id="term-for-propdef-text-emphasis-position" style="color:initial">text-emphasis-position</span>
     <li><span class="dfn-paneled" id="term-for-propdef-text-shadow" style="color:initial">text-shadow</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-text-decor-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-valdef-text-decoration-line-grammar-error" style="color:initial">grammar-error</span>
     <li><span class="dfn-paneled" id="term-for-valdef-text-tecoration-line-spelling-error" style="color:initial">spelling-error</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-ui-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-caret-color" style="color:initial">caret-color</span>
     <li><span class="dfn-paneled" id="term-for-propdef-cursor" style="color:initial">cursor</span>
     <li><span class="dfn-paneled" id="term-for-propdef-outline" style="color:initial">outline</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-WRITING-MODES-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-direction" style="color:initial">direction</span>
     <li><span class="dfn-paneled" id="term-for-propdef-unicode-bidi" style="color:initial">unicode-bidi</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-writing-modes-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-text-combine-upright" style="color:initial">text-combine-upright</span>
    </ul>
   <li>
    <a data-link-type="biblio">[cssom-1]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-cssomstring" style="color:initial">CSSOMString</span>
     <li><span class="dfn-paneled" id="term-for-cssstyledeclaration" style="color:initial">CSSStyleDeclaration</span>
    </ul>
   <li>
    <a data-link-type="biblio">[DOM]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-element" style="color:initial">Element</span>
     <li><span class="dfn-paneled" id="term-for-eventtarget" style="color:initial">EventTarget</span>
    </ul>
   <li>
    <a data-link-type="biblio">[fill-stroke-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-fill-color" style="color:initial">fill-color</span>
     <li><span class="dfn-paneled" id="term-for-propdef-stroke-color" style="color:initial">stroke-color</span>
     <li><span class="dfn-paneled" id="term-for-propdef-stroke-width" style="color:initial">stroke-width</span>
    </ul>
   <li>
    <a data-link-type="biblio">[selectors-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-x" style="color:initial">*</span>
    </ul>
   <li>
    <a data-link-type="biblio">[SELECTORS-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-placeholder-shown-pseudo" style="color:initial">:placeholder-shown</span>
     <li><span class="dfn-paneled" id="term-for-typedef-pseudo-element-selector" style="color:initial">&lt;pseudo-element-selector></span>
     <li><span class="dfn-paneled" id="term-for-compound" style="color:initial">compound selector</span>
     <li><span class="dfn-paneled" id="term-for-originating-element" style="color:initial">originating element</span>
     <li><span class="dfn-paneled" id="term-for-pseudo-element" style="color:initial">pseudo-element</span>
     <li><span class="dfn-paneled" id="term-for-selector" style="color:initial">selector</span>
    </ul>
   <li>
    <a data-link-type="biblio">[WebIDL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-Exposed" style="color:initial">Exposed</span>
     <li><span class="dfn-paneled" id="term-for-this" style="color:initial">this</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]
   <dd>Bert Bos; Elika Etemad; Brad Kemper. <a href="https://www.w3.org/TR/css-backgrounds-3/">CSS Backgrounds and Borders Module Level 3</a>. 17 October 2017. CR. URL: <a href="https://www.w3.org/TR/css-backgrounds-3/">https://www.w3.org/TR/css-backgrounds-3/</a>
   <dt id="biblio-css-cascade-4">[CSS-CASCADE-4]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-4/">CSS Cascading and Inheritance Level 4</a>. 28 August 2018. CR. URL: <a href="https://www.w3.org/TR/css-cascade-4/">https://www.w3.org/TR/css-cascade-4/</a>
   <dt id="biblio-css-color-3">[CSS-COLOR-3]
   <dd>Tantek Çelik; Chris Lilley; David Baron. <a href="https://www.w3.org/TR/css-color-3/">CSS Color Module Level 3</a>. 19 June 2018. REC. URL: <a href="https://www.w3.org/TR/css-color-3/">https://www.w3.org/TR/css-color-3/</a>
   <dt id="biblio-css-color-4">[CSS-COLOR-4]
   <dd>Tab Atkins Jr.; Chris Lilley. <a href="https://www.w3.org/TR/css-color-4/">CSS Color Module Level 4</a>. 5 March 2019. WD. URL: <a href="https://www.w3.org/TR/css-color-4/">https://www.w3.org/TR/css-color-4/</a>
   <dt id="biblio-css-content-3">[CSS-CONTENT-3]
   <dd>Elika Etemad; Dave Cramer. <a href="https://www.w3.org/TR/css-content-3/">CSS Generated Content Module Level 3</a>. 2 June 2016. WD. URL: <a href="https://www.w3.org/TR/css-content-3/">https://www.w3.org/TR/css-content-3/</a>
   <dt id="biblio-css-display-3">[CSS-DISPLAY-3]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-display-3/">CSS Display Module Level 3</a>. 28 August 2018. CR. URL: <a href="https://www.w3.org/TR/css-display-3/">https://www.w3.org/TR/css-display-3/</a>
   <dt id="biblio-css-lists-3">[CSS-LISTS-3]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-lists-3/">CSS Lists Module Level 3</a>. 25 April 2019. WD. URL: <a href="https://www.w3.org/TR/css-lists-3/">https://www.w3.org/TR/css-lists-3/</a>
   <dt id="biblio-css-ruby-1">[CSS-RUBY-1]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-ruby-1/">CSS Ruby Layout Module Level 1</a>. 5 August 2014. WD. URL: <a href="https://www.w3.org/TR/css-ruby-1/">https://www.w3.org/TR/css-ruby-1/</a>
   <dt id="biblio-css-syntax-3">[CSS-SYNTAX-3]
   <dd>Tab Atkins Jr.; Simon Sapin. <a href="https://www.w3.org/TR/css-syntax-3/">CSS Syntax Module Level 3</a>. 20 February 2014. CR. URL: <a href="https://www.w3.org/TR/css-syntax-3/">https://www.w3.org/TR/css-syntax-3/</a>
   <dt id="biblio-css-text-3">[CSS-TEXT-3]
   <dd>Elika Etemad; Koji Ishii; Florian Rivoal. <a href="https://www.w3.org/TR/css-text-3/">CSS Text Module Level 3</a>. 12 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-3/">https://www.w3.org/TR/css-text-3/</a>
   <dt id="biblio-css-text-4">[CSS-TEXT-4]
   <dd>Elika Etemad; Koji Ishii; Alan Stearns. <a href="https://www.w3.org/TR/css-text-4/">CSS Text Module Level 4</a>. 20 September 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-4/">https://www.w3.org/TR/css-text-4/</a>
   <dt id="biblio-css-text-decor-3">[CSS-TEXT-DECOR-3]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-text-decor-3/">CSS Text Decoration Module Level 3</a>. 3 July 2018. CR. URL: <a href="https://www.w3.org/TR/css-text-decor-3/">https://www.w3.org/TR/css-text-decor-3/</a>
   <dt id="biblio-css-text-decor-4">[CSS-TEXT-DECOR-4]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-text-decor-4/">CSS Text Decoration Module Level 4</a>. 13 March 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-decor-4/">https://www.w3.org/TR/css-text-decor-4/</a>
   <dt id="biblio-css-ui-4">[CSS-UI-4]
   <dd>Florian Rivoal. <a href="https://www.w3.org/TR/css-ui-4/">CSS Basic User Interface Module Level 4</a>. 22 December 2017. WD. URL: <a href="https://www.w3.org/TR/css-ui-4/">https://www.w3.org/TR/css-ui-4/</a>
   <dt id="biblio-css-writing-modes-3">[CSS-WRITING-MODES-3]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-3/">CSS Writing Modes Level 3</a>. 24 May 2018. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-3/">https://www.w3.org/TR/css-writing-modes-3/</a>
   <dt id="biblio-css-writing-modes-4">[CSS-WRITING-MODES-4]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-4/">CSS Writing Modes Level 4</a>. 24 May 2018. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-4/">https://www.w3.org/TR/css-writing-modes-4/</a>
   <dt id="biblio-cssom-1">[CSSOM-1]
   <dd>Simon Pieters; Glenn Adams. <a href="https://www.w3.org/TR/cssom-1/">CSS Object Model (CSSOM)</a>. 17 March 2016. WD. URL: <a href="https://www.w3.org/TR/cssom-1/">https://www.w3.org/TR/cssom-1/</a>
   <dt id="biblio-dom">[DOM]
   <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
   <dt id="biblio-fill-stroke-3">[FILL-STROKE-3]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/fill-stroke-3/">CSS Fill and Stroke Module Level 3</a>. 13 April 2017. WD. URL: <a href="https://www.w3.org/TR/fill-stroke-3/">https://www.w3.org/TR/fill-stroke-3/</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
   <dt id="biblio-selectors-4">[SELECTORS-4]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/selectors-4/">Selectors Level 4</a>. 21 November 2018. WD. URL: <a href="https://www.w3.org/TR/selectors-4/">https://www.w3.org/TR/selectors-4/</a>
   <dt id="biblio-uax44">[UAX44]
   <dd>Ken Whistler; Laurențiu Iancu. <a href="https://www.unicode.org/reports/tr44/tr44-24.html">Unicode Character Database</a>. 27 February 2019. Unicode Standard Annex #44. URL: <a href="https://www.unicode.org/reports/tr44/tr44-24.html">https://www.unicode.org/reports/tr44/tr44-24.html</a>
   <dt id="biblio-webidl">[WebIDL]
   <dd>Boris Zbarsky. <a href="https://heycam.github.io/webidl/">Web IDL</a>. 15 December 2016. ED. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-css-fonts-3">[CSS-FONTS-3]
   <dd>John Daggett; Myles Maxfield; Chris Lilley. <a href="https://www.w3.org/TR/css-fonts-3/">CSS Fonts Module Level 3</a>. 20 September 2018. REC. URL: <a href="https://www.w3.org/TR/css-fonts-3/">https://www.w3.org/TR/css-fonts-3/</a>
   <dt id="biblio-css-inline-3">[CSS-INLINE-3]
   <dd>Dave Cramer; Elika Etemad; Steve Zilles. <a href="https://www.w3.org/TR/css-inline-3/">CSS Inline Layout Module Level 3</a>. 8 August 2018. WD. URL: <a href="https://www.w3.org/TR/css-inline-3/">https://www.w3.org/TR/css-inline-3/</a>
   <dt id="biblio-css2">[CSS2]
   <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS2/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS2/">https://www.w3.org/TR/CSS2/</a>
   <dt id="biblio-html5">[HTML5]
   <dd>Ian Hickson; et al. <a href="https://www.w3.org/TR/html5/">HTML5</a>. 27 March 2018. REC. URL: <a href="https://www.w3.org/TR/html5/">https://www.w3.org/TR/html5/</a>
   <dt id="biblio-selectors-3">[SELECTORS-3]
   <dd>Tantek Çelik; et al. <a href="https://www.w3.org/TR/selectors-3/">Selectors Level 3</a>. 6 November 2018. REC. URL: <a href="https://www.w3.org/TR/selectors-3/">https://www.w3.org/TR/selectors-3/</a>
   <dt id="biblio-uax29">[UAX29]
   <dd>Mark Davis. <a href="https://www.unicode.org/reports/tr29/tr29-35.html">Unicode Text Segmentation</a>. 15 February 2019. Unicode Standard Annex #29. URL: <a href="https://www.unicode.org/reports/tr29/tr29-35.html">https://www.unicode.org/reports/tr29/tr29-35.html</a>
   <dt id="biblio-web-animations-1">[WEB-ANIMATIONS-1]
   <dd>Brian Birtles; et al. <a href="https://www.w3.org/TR/web-animations-1/">Web Animations</a>. 11 October 2018. WD. URL: <a href="https://www.w3.org/TR/web-animations-1/">https://www.w3.org/TR/web-animations-1/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=<c- n>Window</c->]
<c- b>interface</c-> <a href="#csspseudoelement"><code class="highlight"><c- g>CSSPseudoElement</c-></code></a> : <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#eventtarget" id="ref-for-eventtarget①"><c- n>EventTarget</c-></a> {
    <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssomstring" id="ref-for-cssomstring②"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-csspseudoelement-type" id="ref-for-dom-csspseudoelement-type②"><c- g>type</c-></a>;
    <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#element" id="ref-for-element④"><c- n>Element</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Element" href="#dom-csspseudoelement-element" id="ref-for-dom-csspseudoelement-element②"><c- g>element</c-></a>;
};

<c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://dom.spec.whatwg.org/#element" id="ref-for-element③①"><c- g>Element</c-></a> {
  <a class="n" data-link-type="idl-name" href="#csspseudoelement" id="ref-for-csspseudoelement②①"><c- n>CSSPseudoElement</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-element-pseudo" id="ref-for-dom-element-pseudo①①"><c- g>pseudo</c-></a>(<a class="n" data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssomstring" id="ref-for-cssomstring①①"><c- n>CSSOMString</c-></a> <a href="#dom-element-pseudo-type-type"><code class="highlight"><c- g>type</c-></code></a>);
};

</pre>
  <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
  <div style="counter-reset:issue">
   <div class="issue"> Are there any other properties that should be included here?<a href="#issue-6ca196f5"> ↵ </a></div>
   <div class="issue"> See <a href="http://lists.w3.org/Archives/Public/www-style/2008Nov/0022.html">F2F minutes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2008Oct/0268.html">dbaron’s message</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0247.html">Daniel’s thread</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0261.html">Gecko notes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0366.html">Opera notes</a>, <a href="http://lists.w3.org/Archives/Public/www-style/2010May/0280.html">Webkit notes</a><a href="#issue-13b80e20"> ↵ </a></div>
   <div class="issue"> Not sure if this is the correct way of describing the way things work.<a href="#issue-271a1b90"> ↵ </a></div>
   <div class="issue"> What should happen with text shadows?
  Drawing them in their original color is disconcerting if that color is not a shade of gray.
  Maybe if the overlay has a background, suppress any text shadows below it?<a href="#issue-d7a7fce8"> ↵ </a></div>
   <div class="issue"> Authors seem to want <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-align">text-align</a> on the list of supported properties.
  See e.g. <a href="http://css-tricks.com/almanac/selectors/p/placeholder/">comments here</a>.<a href="#issue-1631f2fa"> ↵ </a></div>
   <div class="issue"> The identity, lifetime, and nullness of the return value
  (and potential error cases)
  of the <code class="idl"><a data-link-type="idl" href="#dom-element-pseudo">pseudo()</a></code> method is still under discussion.
  See <a href="https://github.com/w3c/csswg-drafts/issues/3607">Issue 3607</a> and <a href="https://github.com/w3c/csswg-drafts/issues/3603">Issue 3603</a>.<a href="#issue-302461e7"> ↵ </a></div>
  </div>
  <aside class="dfn-panel" data-for="selectordef-first-line">
   <b><a href="#selectordef-first-line">#selectordef-first-line</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-first-line">1. Introduction</a>
    <li><a href="#ref-for-selectordef-first-line①">2.1. 
The ::first-line pseudo-element</a> <a href="#ref-for-selectordef-first-line②">(2)</a>
    <li><a href="#ref-for-selectordef-first-line③">2.1.1. 
Finding the First Formatted Line</a> <a href="#ref-for-selectordef-first-line④">(2)</a>
    <li><a href="#ref-for-selectordef-first-line⑤">2.1.2. 
Styling the First Line Pseudo-element</a> <a href="#ref-for-selectordef-first-line⑥">(2)</a> <a href="#ref-for-selectordef-first-line⑦">(3)</a>
    <li><a href="#ref-for-selectordef-first-line⑧">2.1.3. 
Inheritance and the ::first-line Pseudo-element</a> <a href="#ref-for-selectordef-first-line⑨">(2)</a> <a href="#ref-for-selectordef-first-line①⓪">(3)</a>
    <li><a href="#ref-for-selectordef-first-line①①">2.2. 
The ::first-letter pseudo-element</a> <a href="#ref-for-selectordef-first-line①②">(2)</a>
    <li><a href="#ref-for-selectordef-first-line①③">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
    <li><a href="#ref-for-selectordef-first-line①④">4.3. 
Placeholder Input: the ::placeholder pseudo-element</a>
    <li><a href="#ref-for-selectordef-first-line①⑤">5. 
Overlapping Pseudo-element Interactions</a>
    <li><a href="#ref-for-selectordef-first-line①⑥">7. 
Compatibilitiy Syntax</a>
    <li><a href="#ref-for-selectordef-first-line①⑦"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="fictional-tag-sequence">
   <b><a href="#fictional-tag-sequence">#fictional-tag-sequence</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fictional-tag-sequence">2.1. 
The ::first-line pseudo-element</a> <a href="#ref-for-fictional-tag-sequence①">(2)</a> <a href="#ref-for-fictional-tag-sequence②">(3)</a>
    <li><a href="#ref-for-fictional-tag-sequence③">2.1.1. 
Finding the First Formatted Line</a>
    <li><a href="#ref-for-fictional-tag-sequence④">2.2.1. 
Finding the First Letter</a>
    <li><a href="#ref-for-fictional-tag-sequence⑤">2.2.2. 
Styling the ::first-letter Pseudo-element</a>
    <li><a href="#ref-for-fictional-tag-sequence⑥">5. 
Overlapping Pseudo-element Interactions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="first-formatted-line">
   <b><a href="#first-formatted-line">#first-formatted-line</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-first-formatted-line">2.1. 
The ::first-line pseudo-element</a>
    <li><a href="#ref-for-first-formatted-line①">2.2. 
The ::first-letter pseudo-element</a>
    <li><a href="#ref-for-first-formatted-line②">2.2.1. 
Finding the First Letter</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-first-letter">
   <b><a href="#selectordef-first-letter">#selectordef-first-letter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-first-letter">2.2. 
The ::first-letter pseudo-element</a> <a href="#ref-for-selectordef-first-letter①">(2)</a> <a href="#ref-for-selectordef-first-letter②">(3)</a> <a href="#ref-for-selectordef-first-letter③">(4)</a> <a href="#ref-for-selectordef-first-letter④">(5)</a> <a href="#ref-for-selectordef-first-letter⑤">(6)</a> <a href="#ref-for-selectordef-first-letter⑥">(7)</a>
    <li><a href="#ref-for-selectordef-first-letter⑦">2.2.1. 
Finding the First Letter</a> <a href="#ref-for-selectordef-first-letter⑧">(2)</a> <a href="#ref-for-selectordef-first-letter⑨">(3)</a> <a href="#ref-for-selectordef-first-letter①⓪">(4)</a> <a href="#ref-for-selectordef-first-letter①①">(5)</a> <a href="#ref-for-selectordef-first-letter①②">(6)</a>
    <li><a href="#ref-for-selectordef-first-letter①③">2.2.2. 
Styling the ::first-letter Pseudo-element</a> <a href="#ref-for-selectordef-first-letter①④">(2)</a> <a href="#ref-for-selectordef-first-letter①⑤">(3)</a> <a href="#ref-for-selectordef-first-letter①⑥">(4)</a>
    <li><a href="#ref-for-selectordef-first-letter①⑦">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
    <li><a href="#ref-for-selectordef-first-letter①⑧">5. 
Overlapping Pseudo-element Interactions</a> <a href="#ref-for-selectordef-first-letter①⑨">(2)</a>
    <li><a href="#ref-for-selectordef-first-letter②⓪">7. 
Compatibilitiy Syntax</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="highlight-pseudo-element">
   <b><a href="#highlight-pseudo-element">#highlight-pseudo-element</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-highlight-pseudo-element">3.1. 
Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a> <a href="#ref-for-highlight-pseudo-element①">(2)</a>
    <li><a href="#ref-for-highlight-pseudo-element②">3.2. 
Styling Highlights</a> <a href="#ref-for-highlight-pseudo-element③">(2)</a>
    <li><a href="#ref-for-highlight-pseudo-element④">3.3. 
Area of a Highlight</a>
    <li><a href="#ref-for-highlight-pseudo-element⑤">3.4. 
Cascading and Per-Element Highlight Styles</a> <a href="#ref-for-highlight-pseudo-element⑥">(2)</a>
    <li><a href="#ref-for-highlight-pseudo-element⑦">3.5. 
Painting the Highlight</a> <a href="#ref-for-highlight-pseudo-element⑧">(2)</a> <a href="#ref-for-highlight-pseudo-element⑨">(3)</a> <a href="#ref-for-highlight-pseudo-element①⓪">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-selection">
   <b><a href="#selectordef-selection">#selectordef-selection</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-selection">3.1. 
Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a> <a href="#ref-for-selectordef-selection①">(2)</a> <a href="#ref-for-selectordef-selection②">(3)</a>
    <li><a href="#ref-for-selectordef-selection③">3.4. 
Cascading and Per-Element Highlight Styles</a> <a href="#ref-for-selectordef-selection④">(2)</a> <a href="#ref-for-selectordef-selection⑤">(3)</a>
    <li><a href="#ref-for-selectordef-selection⑥">3.5. 
Painting the Highlight</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-inactive-selection">
   <b><a href="#selectordef-inactive-selection">#selectordef-inactive-selection</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-inactive-selection">3.1. 
Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a> <a href="#ref-for-selectordef-inactive-selection①">(2)</a> <a href="#ref-for-selectordef-inactive-selection②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-spelling-error">
   <b><a href="#selectordef-spelling-error">#selectordef-spelling-error</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-spelling-error">3.1. 
Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a> <a href="#ref-for-selectordef-spelling-error①">(2)</a>
    <li><a href="#ref-for-selectordef-spelling-error②">3.5. 
Painting the Highlight</a>
    <li><a href="#ref-for-selectordef-spelling-error③">3.6. 
Security and Privacy Considerations</a>
    <li><a href="#ref-for-selectordef-spelling-error④"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-grammar-error">
   <b><a href="#selectordef-grammar-error">#selectordef-grammar-error</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-grammar-error">3.1. 
Selecting Highlighted Content: the ::selection,  ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements</a> <a href="#ref-for-selectordef-grammar-error①">(2)</a>
    <li><a href="#ref-for-selectordef-grammar-error②">3.5. 
Painting the Highlight</a>
    <li><a href="#ref-for-selectordef-grammar-error③">3.6. 
Security and Privacy Considerations</a>
    <li><a href="#ref-for-selectordef-grammar-error④"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="highlight-overlay">
   <b><a href="#highlight-overlay">#highlight-overlay</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-highlight-overlay">3.4. 
Cascading and Per-Element Highlight Styles</a>
    <li><a href="#ref-for-highlight-overlay①">3.5. 
Painting the Highlight</a> <a href="#ref-for-highlight-overlay②">(2)</a> <a href="#ref-for-highlight-overlay③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-before">
   <b><a href="#selectordef-before">#selectordef-before</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-before">2.2.1. 
Finding the First Letter</a>
    <li><a href="#ref-for-selectordef-before①">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a> <a href="#ref-for-selectordef-before②">(2)</a>
    <li><a href="#ref-for-selectordef-before③">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-selectordef-before④">5. 
Overlapping Pseudo-element Interactions</a>
    <li><a href="#ref-for-selectordef-before⑤">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-selectordef-before⑥">7. 
Compatibilitiy Syntax</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-after">
   <b><a href="#selectordef-after">#selectordef-after</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-after">2.2.1. 
Finding the First Letter</a>
    <li><a href="#ref-for-selectordef-after①">4.1. 
Generated Content Pseudo-elements: ::before and ::after</a>
    <li><a href="#ref-for-selectordef-after②">4.2. 
List Markers: the ::marker pseudo-element</a>
    <li><a href="#ref-for-selectordef-after③">5. 
Overlapping Pseudo-element Interactions</a>
    <li><a href="#ref-for-selectordef-after④">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-selectordef-after⑤">7. 
Compatibilitiy Syntax</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-marker">
   <b><a href="#selectordef-marker">#selectordef-marker</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-marker">4.2. 
List Markers: the ::marker pseudo-element</a> <a href="#ref-for-selectordef-marker①">(2)</a> <a href="#ref-for-selectordef-marker②">(3)</a> <a href="#ref-for-selectordef-marker③">(4)</a>
    <li><a href="#ref-for-selectordef-marker④">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-selectordef-marker⑤"> Changes</a> <a href="#ref-for-selectordef-marker⑥">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="selectordef-placeholder">
   <b><a href="#selectordef-placeholder">#selectordef-placeholder</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-placeholder">4.3. 
Placeholder Input: the ::placeholder pseudo-element</a> <a href="#ref-for-selectordef-placeholder①">(2)</a> <a href="#ref-for-selectordef-placeholder②">(3)</a> <a href="#ref-for-selectordef-placeholder③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="csspseudoelement">
   <b><a href="#csspseudoelement">#csspseudoelement</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-csspseudoelement">6.1. 
CSSPseudoElement Interface</a> <a href="#ref-for-csspseudoelement①">(2)</a>
    <li><a href="#ref-for-csspseudoelement②">6.2. 
pseudo() method of the Element interface</a> <a href="#ref-for-csspseudoelement③">(2)</a> <a href="#ref-for-csspseudoelement④">(3)</a> <a href="#ref-for-csspseudoelement⑤">(4)</a>
    <li><a href="#ref-for-csspseudoelement⑥"> Changes</a> <a href="#ref-for-csspseudoelement⑦">(2)</a> <a href="#ref-for-csspseudoelement⑧">(3)</a> <a href="#ref-for-csspseudoelement⑨">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-csspseudoelement-type">
   <b><a href="#dom-csspseudoelement-type">#dom-csspseudoelement-type</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-csspseudoelement-type">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-dom-csspseudoelement-type①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-csspseudoelement-element">
   <b><a href="#dom-csspseudoelement-element">#dom-csspseudoelement-element</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-csspseudoelement-element">6.1. 
CSSPseudoElement Interface</a>
    <li><a href="#ref-for-dom-csspseudoelement-element①"> Changes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-element-pseudo-type-type">
   <b><a href="#dom-element-pseudo-type-type">#dom-element-pseudo-type-type</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-element-pseudo-type-type">6.2. 
pseudo() method of the Element interface</a> <a href="#ref-for-dom-element-pseudo-type-type①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-element-pseudo">
   <b><a href="#dom-element-pseudo">#dom-element-pseudo</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-element-pseudo">6.2. 
pseudo() method of the Element interface</a> <a href="#ref-for-dom-element-pseudo①">(2)</a> <a href="#ref-for-dom-element-pseudo②">(3)</a>
    <li><a href="#ref-for-dom-element-pseudo③"> Changes</a>
   </ul>
  </aside>
<script>/* script-var-click-highlighting */

    document.addEventListener("click", e=>{
        if(e.target.nodeName == "VAR") {
            highlightSameAlgoVars(e.target);
        }
    });
    {
        const indexCounts = new Map();
        const indexNames = new Map();
        function highlightSameAlgoVars(v) {
            // Find the algorithm container.
            let algoContainer = null;
            let searchEl = v;
            while(algoContainer == null && searchEl != document.body) {
                searchEl = searchEl.parentNode;
                if(searchEl.hasAttribute("data-algorithm")) {
                    algoContainer = searchEl;
                }
            }

            // Not highlighting document-global vars,
            // too likely to be unrelated.
            if(algoContainer == null) return;

            const algoName = algoContainer.getAttribute("data-algorithm");
            const varName = getVarName(v);
            const addClass = !v.classList.contains("selected");
            let highlightClass = null;
            if(addClass) {
                const index = chooseHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] += 1;
                indexNames.set(algoName+"///"+varName, index);
                highlightClass = nameFromIndex(index);
            } else {
                const index = previousHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] -= 1;
                highlightClass = nameFromIndex(index);
            }

            // Find all same-name vars, and toggle their class appropriately.
            for(const el of algoContainer.querySelectorAll("var")) {
                if(getVarName(el) == varName) {
                    el.classList.toggle("selected", addClass);
                    el.classList.toggle(highlightClass, addClass);
                }
            }
        }
        function getVarName(el) {
            return el.textContent.replace(/(\s| )+/, " ").trim();
        }
        function chooseHighlightIndex(algoName, varName) {
            let indexes = null;
            if(indexCounts.has(algoName)) {
                indexes = indexCounts.get(algoName);
            } else {
                // 7 classes right now
                indexes = [0,0,0,0,0,0,0];
                indexCounts.set(algoName, indexes);
            }

            // If the element was recently unclicked,
            // *and* that color is still unclaimed,
            // give it back the same color.
            const lastIndex = previousHighlightIndex(algoName, varName);
            if(indexes[lastIndex] === 0) return lastIndex;

            // Find the earliest index with the lowest count.
            const minCount = Math.min.apply(null, indexes);
            let index = null;
            for(var i = 0; i < indexes.length; i++) {
                if(indexes[i] == minCount) {
                    return i;
                }
            }
        }
        function previousHighlightIndex(algoName, varName) {
            return indexNames.get(algoName+"///"+varName);
        }
        function nameFromIndex(index) {
            return "selected" + index;
        }
    }
    </script>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>